[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-07 Thread Zack Weinberg
Zack Weinberg added the comment: OK, here is a patch against the latest development version. Now also with tests and documentation updates. -- Added file: http://bugs.python.org/file28247/issue16624-v34.diff ___ Python tracker rep

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-07 Thread Zack Weinberg
Changes by Zack Weinberg za...@panix.com: Removed file: http://bugs.python.org/file28218/subprocess-check-output-allow-input.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-07 Thread Zack Weinberg
Zack Weinberg added the comment: I don't have the ability to test on Windows, but the construct you are concerned about was copied from other tests in the same file which were not marked as Unix-only. I have faxed in a contributor agreement

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-01-28 Thread Zack Weinberg
Zack Weinberg added the comment: Contributor agreement resent by email. Sorry for the delay. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: Here is a new patch vs latest trunk. -- Added file: http://bugs.python.org/file29924/issue16624-v34a.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Changes by Zack Weinberg za...@panix.com: Removed file: http://bugs.python.org/file28247/issue16624-v34.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: I think that it will be better not introduce a new argument, but reuse stdin. Just allow io.BytesIO (or perhaps even any file object) be specified as stdin. If we were designing from scratch I might agree, but we aren't. Principle of least astonishment says

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: Note also that allowing `stdin=any filelike` in a clean fashion would require rather more surgery than you suggest, because a filelike can produce an infinite stream of data, and people would expect that to work when the subprocess only reads a finite prefix

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: My position is: * input= should be supported in check_output(), for consistency with communicate(). * I like the idea of making stdin= support file-like objects which don't have a fileno, in both communicate() and everything that calls it, but that does

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: ??? communicate() has always had input= AFAIK. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2013-04-18 Thread Zack Weinberg
Zack Weinberg added the comment: OK, I get that, but what I'm saying is I think input= is still desirable even if stdin= becomes more powerful. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16624

[issue16624] subprocess.check_output should allow specifying stdin as a string

2012-12-05 Thread Zack Weinberg
New submission from Zack Weinberg: subprocess.check_output calls Popen.communicate but does not allow you to specify its argument (i.e. data to send to the child process's stdin). It would be nice if it were enhanced to allow this. Proposed patch attached (to the 2.7 subprocess.py; should

[issue23518] Misplaced diagnostic caret for some SyntaxErrors

2015-02-25 Thread Zack Weinberg
Zack Weinberg added the comment: In terms of the formal grammar of the language, you are correct. However, the position of the caret should be chosen based *not* on the formal grammar, but on a heuristic estimation of what the most probable mistake actually is. In both of the cases I listed

[issue23518] Misplaced diagnostic caret for some SyntaxErrors

2015-02-24 Thread Zack Weinberg
New submission from Zack Weinberg: I tripped over a couple of SyntaxError cases where the diagnostic caret is misplaced. While x: File stdin, line 1 While x: ^ SyntaxError: invalid syntax The caret should point to the capital W in 'While'. for x

[issue25743] Clarify exactly what \w matches in UNICODE mode

2015-11-27 Thread Zack Weinberg
New submission from Zack Weinberg: The `re` module documentation does not do a good job of explaining exactly what `\w` matches. Quoting https://docs.python.org/3.5/library/re.html : > \w > For Unicode (str) patterns: > Matches Unicode word characters; this includes most characters &

[issue25743] Clarify exactly what \w matches in UNICODE mode

2015-11-27 Thread Zack Weinberg
Zack Weinberg added the comment: FWIW, the actual behavior of \w matching "everything in Unicode general categories L* and N*, plus U+005F (underscore)" is consistent across all versions I can conveniently test (2.7, 3.4, 3.5). In 2.7, there are four characters in general category

[issue26666] File object hook to modify select(ors) event mask

2016-03-29 Thread Zack Weinberg
New submission from Zack Weinberg: This is pretty esoteric, please bear with me. I'm attempting to enhance a transparent-SOCKS module (https://github.com/Anorov/PySocks) to support non-blocking connect(). This means, you should be able to do this: socks.set_default_proxy(socks.SOCKS5

[issue26666] File object hook to modify select(ors) event mask

2016-03-29 Thread Zack Weinberg
Zack Weinberg added the comment: > Obvious question: why not working on the asyncio support in this library? The whole point of a transparent SOCKS module is that it provides a function that's a *drop-in replacement* for socket.socket(). An asyncio-based SOCKS module would have a complet

[issue27496] unicodedata.name() doesn't have names for control characters

2016-07-12 Thread Zack Weinberg
New submission from Zack Weinberg: unicodedata.name() doesn't have name information for the C0 and C1 control characters. To see this, run pprint.pprint(["U+{:04X} {}".format(n, unicodedata.name(chr(n), "")) for n in range(256)]) and you will observe printed for U+

[issue27496] unicodedata.name() doesn't have names for control characters

2016-07-12 Thread Zack Weinberg
Zack Weinberg added the comment: It looks to me as if NameAliases.txt is the better reference for the C0 and C1 controls. It matches the UnicodeData.txt field 10 names for most entries where the field 1 name is "", but it has names for U+0080, U+0081, U+0084, and U+0099, which hav

[issue27446] struct: allow per-item byte order

2016-07-03 Thread Zack Weinberg
New submission from Zack Weinberg: Occasionally one encounters binary formats which do not stick to one byte order throughout. For example, I have a C program that reads and writes arrays of this struct: ``` struct conn_data { uint32_t ipv4_addr; /* read - network byte order - target IPv4

[issue32511] Thread primitives do not report the OS-level error on failure

2018-01-07 Thread Zack Weinberg
New submission from Zack Weinberg <za...@panix.com>: [_]thread.start_new_thread can fail if the underlying OS primitive fails (pthread_create / _beginthreadex), but the exception that is thrown when this happens is a generic RuntimeError (it's _called_ ThreadError in the source

[issue34156] Nail down and document the behavior of range expressions in RE character classes

2018-07-19 Thread Zack Weinberg
New submission from Zack Weinberg : The documentation of the semantics of range expressions in regular expression character classes is not precise enough. All it says is Ranges of characters can be indicated by giving two characters and separating them by a '-', for example [a-z

[issue34156] Nail down and document the behavior of range expressions in RE character classes

2018-07-19 Thread Zack Weinberg
Zack Weinberg added the comment: Also, whether or not the current behavior is the intended behavior, I think programmers would appreciate an explicit statement of whether or not it might change in the future. -- ___ Python tracker <ht

[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2019-04-05 Thread Zack Weinberg
Zack Weinberg added the comment: I have observed this problem in a production application using Python 3.5 and 3.6 (system-packaged interpreters from Ubuntu) and I would like to mention that this is an effective workaround: ``` import ctypes libgcc_s = ctypes.CDLL("libgcc_s

[issue37395] Core interpreter should be linked with libgcc_s.so on Linux

2019-06-24 Thread Zack Weinberg
New submission from Zack Weinberg : There are several existing issues (e.g. #18748 and #35866) where at least part of the problem is that GNU libc tried to dlopen() `libgcc_s.so` at a moment when that's not safe, e.g. during thread or process shutdown. This converts a recoverable error

[issue18748] io.IOBase destructor silence I/O error on close() by default

2019-07-04 Thread Zack Weinberg
Zack Weinberg added the comment: > To be clear: this issue is NOT a bug in Python I don't think that's entirely true. I think CPython needs to be linked against libgcc_s.so, so that this class of application bugs will no longer manifest as interpreter crashes. I filed #37

[issue38727] setup.py sdist --format=gztar should use (equivalent of) `gzip -n`

2019-11-06 Thread Zack Weinberg
New submission from Zack Weinberg : Recent versions of the gzip command-line utility have an option `-n` which causes it to omit the FNAME field of the gzip file header, and write out the MTIME field as zero. Both of these properties are desirable when constructing reproducible build

[issue38725] Documented equivalent of `gzip -n` (omit timestamp and original file name) in gzip module

2019-11-06 Thread Zack Weinberg
New submission from Zack Weinberg : Recent versions of the gzip command-line utility have an option `-n` which causes it to omit the FNAME field of the gzip file header, and write out the MTIME field as zero. Both of these properties are desirable when constructing reproducible build

[issue38726] Add equivalent of `gzip -n` (omit timestamp and original file name) to tarfile module's auto-compression support

2019-11-06 Thread Zack Weinberg
New submission from Zack Weinberg : Recent versions of the gzip command-line utility have an option `-n` which causes it to omit the FNAME field of the gzip file header, and write out the MTIME field as zero. Both of these properties are desirable when constructing reproducible build

[issue38632] setup.py sdist should honor SOURCE_DATE_EPOCH

2019-10-29 Thread Zack Weinberg
New submission from Zack Weinberg : Reproducibility has so far been concerned primarily with binary packages, but it's also desirable for source tarballs to be reproducible starting from a version-control checkout. This is particularly important for Python, where 'setup.py sdist' can run

[issue18233] SSLSocket.getpeercertchain()

2020-06-29 Thread Zack Weinberg
Zack Weinberg added the comment: I have yet another use case for the function implemented by this patch (i.e. retrieving the cert chain actually sent by the server, regardless of whether that gives a path to a trust anchor). I'm implementing a network forensics tool, and one

[issue38727] setup.py sdist --format=gztar should use (equivalent of) `gzip -n`

2020-10-22 Thread Zack Weinberg
Zack Weinberg added the comment: The code that needs to be changed is in distutils, setuptools just calls into it. I haven't checked flit but I expect it does the same. -- ___ Python tracker <https://bugs.python.org/issue38