[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-09-08 Thread Manuel Jacob
Manuel Jacob added the comment: I was running "make all" and I also ran the documentation generator command without an error. However, I tried it again and now it failed the same way as reported. With a debug build, I get "Python/Python-ast.c:231: get_ast_state: Assertion

[issue41631] _ast module: get_global_ast_state() doesn't work with Mercurial lazy import

2020-09-08 Thread Manuel Jacob
Manuel Jacob added the comment: I couldn’t reproduce the problem with a freshly compiled Python 3.9.0rc1 on Arch Linux. Was this ever reproduced on a non-Red Hat system? -- nosy: +mjacob ___ Python tracker <https://bugs.python.org/issue41

[issue41221] Output of print() might get truncated in unbuffered mode

2020-07-06 Thread Manuel Jacob
Manuel Jacob added the comment: It’s possible to trigger the problem on Unix with much smaller sizes, e.g. by interrupting the write() with a signal handler (even if the signal handler doesn’t do anything). The following script starts a subprocess doing a 16MiB write and sends a signal

[issue41221] Output of print() might get truncated in unbuffered mode

2020-07-06 Thread Manuel Jacob
Manuel Jacob added the comment: `io.TextIOWrapper.write()` returns the length of the passed string instead of the actually written number of characters. % python -u -c "import sys; print(sys.stdout.write('x'*4294967296), file=sys.stderr)" | wc -c 4294967296 2147479552

[issue41221] Output of print() might get truncated in unbuffered mode

2020-07-06 Thread Manuel Jacob
Manuel Jacob added the comment: 2147479552 is the 0x7000 bytes limit documented for write() on Linux (source: https://man7.org/linux/man-pages/man2/write.2.html). The limit could be even smaller in other circumstances or other systems. I’m adding Victor Stinner to the nosy list, as he

[issue41221] Output of print() might get truncated in unbuffered mode

2020-07-06 Thread Manuel Jacob
New submission from Manuel Jacob : Without unbuffered mode, it works as expected: % python -c "import sys; sys.stdout.write('x'*4294967296)" | wc -c 4294967296 % python -c "import sys; print('x'*4294967296)" | wc -c 4294967297 With unbuffered

[issue41091] Remove recommendation in curses module documentation to initialize LC_ALL and encode strings

2020-06-25 Thread Manuel Jacob
Change by Manuel Jacob : -- keywords: +patch pull_requests: +20319 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21159 ___ Python tracker <https://bugs.python.org/issu

[issue41091] Remove recommendation in curses module documentation to initialize LC_ALL and encode strings

2020-06-23 Thread Manuel Jacob
New submission from Manuel Jacob : The documentation for the curses module (https://docs.python.org/3.9/library/curses.html) has the following note: > Since version 5.4, the ncurses library decides how to interpret non-ASCII > data using the nl_langinfo function. That means that you h

[issue41051] Flush file after warning is written

2020-06-20 Thread Manuel Jacob
Change by Manuel Jacob : -- keywords: +patch pull_requests: +20175 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21000 ___ Python tracker <https://bugs.python.org/issu

[issue41051] Flush file after warning is written

2020-06-20 Thread Manuel Jacob
New submission from Manuel Jacob : Calling warnings.warn() will write to a file, but not flush it. On Python 3.9+, it won’t usually be a problem because the file is most likely stderr, which is always line-buffered. However, on older Python versions or if a different file is used, the current

[issue17110] sys.argv docs should explaining how to handle encoding issues

2020-06-18 Thread Manuel Jacob
Manuel Jacob added the comment: If the encoding supports it, since which Python version do Py_DecodeLocale() and os.fsencode() roundtrip? The background of my question is that Mercurial goes some extra rounds to determine the correct encoding to emulate what Py_EncodeLocale() would do

[issue41012] Some code comments refer to removed initfsencoding()

2020-06-17 Thread Manuel Jacob
New submission from Manuel Jacob : Some code comments refer to initfsencoding(), which was however removed after Python 3.7. -- messages: 371779 nosy: mjacob priority: normal severity: normal status: open title: Some code comments refer to removed initfsencoding

[issue17110] sys.argv docs should explaining how to handle encoding issues

2020-06-17 Thread Manuel Jacob
Manuel Jacob added the comment: The actual startup code uses Py_DecodeLocale() for converting argv from bytes to unicode. Since which Python version is it guaranteed that Py_DecodeLocale() and os.fsencode() roundtrip? -- nosy: +mjacob ___ Python

[issue40983] urllib.request.url2pathname() unconditionally uses utf-8 encoding and "replace" error handler

2020-06-16 Thread Manuel Jacob
Manuel Jacob added the comment: I’ve created issue40996, which suggests that urllib should fsdecode percent-encoded parts of file URIs on Unix. Since the two tickets are very related and I’d prefer if the issue was solved more generally for the whole module, I close this as a duplicate

[issue40996] urllib should fsdecode percent-encoded parts of file URIs on Unix

2020-06-16 Thread Manuel Jacob
New submission from Manuel Jacob : On Unix, file names are bytes. Python mostly prefers to use unicode for file names. On the Python <-> system boundary, os.fsencode() / os.fsdecode() are used. In URIs, bytes can be percent-encoded. On Unix, most applications pass the percent-decoded

[issue40983] urllib.request.url2pathname() unconditionally uses utf-8 encoding and "replace" error handler

2020-06-16 Thread Manuel Jacob
Change by Manuel Jacob : -- title: Can’t configure encoding used by urllib.request.url2pathname() -> urllib.request.url2pathname() unconditionally uses utf-8 encoding and "replace" error handler ___ Python tracker <https:/

[issue40983] Can’t configure encoding used by urllib.request.url2pathname()

2020-06-15 Thread Manuel Jacob
New submission from Manuel Jacob : On Python 2, it was possible to recover a percent-encoded byte: >>> from urllib import url2pathname >>> url2pathname('%ff') '\xff' On Python 3, the byte is decoded using the utf-8 encoding and the "replace" er

[issue40868] io.TextIOBase.buffer is not necessarily a buffer

2020-06-04 Thread Manuel Jacob
New submission from Manuel Jacob : https://docs.python.org/dev/library/io.html#io.TextIOBase.buffer says: "The underlying binary buffer (a BufferedIOBase instance) that TextIOBase deals with. This is not part of the TextIOBase API and may not exist in some implementations."

[issue40457] Python fails to compile/load _ssl module if OpenSSL is compiled with no-tls1-method

2020-05-31 Thread Manuel Jacob
Manuel Jacob added the comment: For the record, I’ve added a comment to the pull request about that ssl.PROTOCOL_TLSv1_1 / ssl.PROTOCOL_TLSv1_2 are now defined unconditionally. https://github.com/python/cpython/commit/6e8cda91d92da72800d891b2fc2073ecbc134d98#r39569316 -- nosy

[issue29830] pyexpat.errors doesn't have __spec__ and __loader__ set

2017-03-17 Thread Manuel Jacob
Manuel Jacob added the comment: You're of course right that pyexpat is an extension module and not a builtin module. I was confused because on PyPy it's a builtin module. But the same question applies for ExtensionFileLoader.is_package(). It returns False in the case of pyex

[issue29830] pyexpat.errors doesn't have __spec__ and __loader__ set

2017-03-16 Thread Manuel Jacob
New submission from Manuel Jacob: The same applies to pyexpat.model. It seems like pyexpat is the only builtin module which has submodules (errors, model). Normally, as I understand it, the module gets imported given a spec and the import machinery ensures that this spec ends up in the

[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-21 Thread Manuel Jacob
Manuel Jacob added the comment: I think the "What's New" entry has two typos. It should be `importlib.__import__()` instead of `importlib.__init__()` and SystemError instead of RuntimeError. -- ___ Python tracker <http

[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-18 Thread Manuel Jacob
Manuel Jacob added the comment: Done. I'm a bit surprised this wasn't necessary for my previous two patches, but they were even more trival than this one. ;) Do we have to wait until my tracker profile is updated? -- ___ Python trac

[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-18 Thread Manuel Jacob
Manuel Jacob added the comment: (For some reason, I forgot to submit the previous comment). The attached patches fix the issue (one for the 3.5 branch, one for the default branch) by bringing importlib.__import__ closer to the builtin __import__. The extra code in the default / 3.6 branch is

[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-16 Thread Manuel Jacob
Changes by Manuel Jacob : Added file: http://bugs.python.org/file41938/relimport-3.6.patch ___ Python tracker <http://bugs.python.org/issue26367> ___ ___ Python-bug

[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-16 Thread Manuel Jacob
Changes by Manuel Jacob : -- keywords: +patch Added file: http://bugs.python.org/file41937/relimport-3.5.patch ___ Python tracker <http://bugs.python.org/issue26

[issue26367] importlib.__import__ does not fail for invalid relative import

2016-02-15 Thread Manuel Jacob
New submission from Manuel Jacob: Python 3.6.0a0 (default:6c6f7dff597b, Feb 16 2016, 01:24:51) [GCC 5.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import importlib >>> importlib.__import__(&#x

[issue17576] PyNumber_Index() is not int-subclass friendly (or operator.index() docos lie)

2015-02-24 Thread Manuel Jacob
Manuel Jacob added the comment: Maybe I'm missing something, but it seems to me that test_int_subclass_with_index() is testing for the exactly wrong behaviour. Isn't the point of this issue that operator.index(a) should be equal to a.__index__()? Why are the tests checking tha

[issue17336] Complex number representation round-trip doesn't work with signed zero values

2013-03-02 Thread Manuel Jacob
New submission from Manuel Jacob: When evaluating, signed zero complex numbers aren't recovered correctly. >>> -0j (-0-0j) >>> (-0-0j) 0j >>> 0j 0j According to http://docs.python.org/dev/reference/datamodel.html#object.__repr__ the representation can be use

[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-02-23 Thread Manuel Jacob
Manuel Jacob added the comment: http://docs.python.org/3/library/array.html states that the 'u' type code is deprecated together with the rest of the Py_UNICODE API (which includes PyUnicode_FromUnicode), so keeping this using PyUnicode_FromUnicode shoul

[issue17275] io.BufferedWriter shows wrong type in argument error message

2013-02-22 Thread Manuel Jacob
Manuel Jacob added the comment: Added a new patch including tests for the C implementations of BufferedWriter and BufferedRandom. -- Added file: http://bugs.python.org/file29164/issue17275_with_test.diff ___ Python tracker <http://bugs.python.

[issue17275] io.BufferedWriter shows wrong type in argument error message

2013-02-22 Thread Manuel Jacob
Manuel Jacob added the comment: The attached patch fixes the issue. Should I write a test? -- keywords: +patch Added file: http://bugs.python.org/file29161/issue17275.diff ___ Python tracker <http://bugs.python.org/issue17

[issue17275] io.BufferedWriter shows wrong type in argument error message

2013-02-22 Thread Manuel Jacob
New submission from Manuel Jacob: >>> import io >>> io.BufferedWriter(io.BytesIO(), 1024, 1024, 1024) Traceback (most recent call last): File "", line 1, in TypeError: BufferedReader() takes at most 2 arguments (4 given) It should be "BufferedWri

[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-02-17 Thread Manuel Jacob
Manuel Jacob added the comment: I've attached a new patch with a test that segfaults on Python 3.3 and passes on hg tip with the patch applied. -- Added file: http://bugs.python.org/file29110/issue17223_with_test.diff ___ Python tracker

[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-02-17 Thread Manuel Jacob
Manuel Jacob added the comment: The attached patch fixes the crash. Output: >>> from array import array >>> str(array('u', b'asdf')) Traceback (most recent call last): File "", line 1, in ValueError: character U+66647361 is not in range [U+00

[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-02-17 Thread Manuel Jacob
New submission from Manuel Jacob: >>> from array import array >>> str(array('u', b'asdf')) [1]19411 segmentation fault (core dumped) python This error occures with Python 3.3 and hg tip but not with Python 3.2. -- components: Librar