[issue25567] shlex.quote doesn't work on bytestrings

2021-04-26 Thread Shatabarto Bhattacharya


Shatabarto Bhattacharya  added the comment:

Looks like this issue has been solved?
What is there to be worked on?

--
nosy: +hrik2001

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2021-01-24 Thread techfixya


techfixya  added the comment:

How to Install Brother mfc-l2740dw driver on Windows
https://techfixya.com/how-to-install-brother-mfc-l2740dw-driver-on-windows/

--
nosy: +techfixya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2020-10-11 Thread Hassan Abouelela


Change by Hassan Abouelela :


--
nosy: +HassanAbouelela
nosy_count: 9.0 -> 10.0
pull_requests: +21634
pull_request: https://github.com/python/cpython/pull/22657

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2020-05-28 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

The first pull request has been closed, so this issue is available to be worked 
on.  If the original patch or PR are used, please credit the original authors.  
Thanks!

--
nosy: +cheryl.sabella
versions: +Python 3.10 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2019-06-14 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

Python 3.9.0a0
[GCC 7.3.0] on linux
>>> import re
>>> find_unsafe_bytes = re.compile(b'[^\w@%+=:,./-]').search
:1: SyntaxWarning: invalid escape sequence \w

when removing \w, all the tests pass

(my regex knowledge is close to None.)

"\w stands for "word character". It always matches the ASCII characters 
[A-Za-z0-9_]"

replace \w with A-Za-z0-9_ ?? (all the tests pass)

--
nosy: +aldwinaldwin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2018-12-03 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +10106

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2018-09-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the patch since the current workflow uses GitHub PR the patch can be 
made as a PR to move it forward. It seems there are some conflicts as I tried 
to apply the attached patch against latest master.

Thanks

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2015-12-14 Thread Martin Panter

Martin Panter added the comment:

I think the documentation needs a “Changed in version 3.6” notice

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2015-12-14 Thread Carol Willing

Changes by Carol Willing :


--
nosy: +willingc
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2015-11-09 Thread Nan Wu

Nan Wu added the comment:

Added a patch for support this in `quote` method. What is a good example or a 
group of examples to demonstrate the usage in the document?

--
keywords: +patch
nosy: +Nan Wu
Added file: http://bugs.python.org/file40992/shlex_quote_bytes_support.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2015-11-06 Thread R. David Murray

R. David Murray added the comment:

I think that this is a reasonable request, and probably applies to the whole 
shlex module, although less strongly.

You could use the surrogateescape hack to work around the problem:

  shlex.quote(mydata.encode('ascii', 'surrogateescape')).decode('ascii', 
'surrogateescape)

That might be the only practical way to handle bytes input to the shlex parser, 
if we do also want to tackle that.

Note that it is already the case that os module functions that retrn filenames 
and stdin/stdout use surrogateescape, so a naive program may actually work with 
binary filenames (which is why the handler is used in those contexts).

--
keywords: +easy
nosy: +r.david.murray
stage:  -> needs patch
type: behavior -> enhancement
versions: +Python 3.6 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25567] shlex.quote doesn't work on bytestrings

2015-11-06 Thread Jonas Thiem

New submission from Jonas Thiem:

Demonstration:

>>> import shlex
>>> shlex.quote(b"abc")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.4/shlex.py", line 285, in quote
if _find_unsafe(s) is None:
TypeError: can't use a string pattern on a bytes-like object
>>>

Your question is now probably, why would anyone not want to use unicode strings 
here?

The reason is that for some operations (e.g. file access to some known paths) 
decoding and encoding from/to any sort of unicode interpretation can be lossy, 
specifically when the file path on the filesystem has broken/mixed encoding 
characters. In such a case, the shell command might need to be supplied as 
bytestring to ensure it is sent exactly as-is so such broken files can still be 
dealt with, without the Unicode interpretation possibly deforming the path in 
some bytes.

Since shlex.quote seems targeted at shell usage, it should therefore support 
this.

--
components: Library (Lib)
messages: 254186
nosy: Jonas Thiem, The Compiler
priority: normal
severity: normal
status: open
title: shlex.quote doesn't work on bytestrings
type: behavior
versions: Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com