Opened 2 years ago

Closed 2 years ago

#31076 closed Bug (fixed)

dbshell crashes on Windows and Python < 3.8.

Reported by: Mariusz Felisiak Owned by: zeynel
Component: Database layer (models, ORM) Version: dev
Severity: Release blocker Keywords:
Cc: Jon Dufresne, Carlton Gibson Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

subprocess.run()'s args parameter accepts a path-like object on Windows since Python 3.8 (see documentation), so 26554cf5d1e96db10d0d5f4b69683a22fb82fdf8 broke using manage.py dbshell (maybe sth more) on Windows and Python < 3.8.

  File "C:\Python37\lib\subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Python37\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Python37\lib\subprocess.py", line 1119, in _execute_child
    args = list2cmdline(args)
  File "C:\Python37\lib\subprocess.py", line 530, in list2cmdline
    needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: argument of type 'WindowsPath' is not iterable

Regression in 26554cf5d1e96db10d0d5f4b69683a22fb82fdf8.

Change History (6)

comment:1 Changed 2 years ago by Carlton Gibson

Grrr. OK, this is an annoying one. Path is such a nice touch, by preference, I´d rather guard against this at the call point (casting with str()) than revert the change here.

comment:2 Changed 2 years ago by zeynel

Owner: changed from nobody to zeynel
Status: newassigned

comment:3 Changed 2 years ago by zeynel

Has patch: set

comment:4 Changed 2 years ago by Mariusz Felisiak

Needs tests: set

comment:5 Changed 2 years ago by Mariusz Felisiak

Needs tests: unset
Triage Stage: AcceptedReady for checkin

comment:6 Changed 2 years ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In 9d40b6bb:

Fixed #31076 -- Fixed dbshell crash on Windows with Python < 3.8.

subprocess.run()'s args parameter accepts path-like objects on Windows
since Python 3.8.

Note: See TracTickets for help on using tickets.
Back to Top