[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails

2008-06-27 Thread Martijn Pieters
Martijn Pieters <[EMAIL PROTECTED]> added the comment: I've created a python 2.4 compatible distribution of the python 2.5 urllib2 and httplib modules with the patch attached to this issue. This has proven especially useful in zc.buildout or other setuptools environmen

[issue38364] inspect.iscoroutinefunction / isgeneratorfunction / isasyncgenfunction can't handle partialmethod objects

2019-10-03 Thread Martijn Pieters
New submission from Martijn Pieters : This is a follow-up to #33261, which added general support for detecting generator / coroutine / async generator functions wrapped in partials. It appears that partialmethod objects were missed out. While a partialmethod object will produce a

[issue38374] Remove weakref.ReferenceError entry from documentation

2019-10-04 Thread Martijn Pieters
New submission from Martijn Pieters : The weakref documentation still mentions weakref.ReferenceError: https://docs.python.org/3/library/weakref.html#weakref.ReferenceError But this alias for the built-in ReferenceError exception was removed in the 3.0 development cycle (https://github.com

[issue38364] inspect.iscoroutinefunction / isgeneratorfunction / isasyncgenfunction can't handle partialmethod objects

2019-10-05 Thread Martijn Pieters
Change by Martijn Pieters : -- keywords: +patch pull_requests: +16188 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16600 ___ Python tracker <https://bugs.python.org/issu

[issue44167] ipaddress.IPv6Address.is_private makes redundant checks

2021-05-18 Thread Martijn Pieters
New submission from Martijn Pieters : ipaddress.IPv6Address.is_private uses a hard-coded list of `IPv6Network` objects that cover private networks to test against. This list contains two networks that are subnets of a 3rd network in the list. IP addresses that are not private are tested

[issue42937] 192.0.0.8 (IPv4 dummy address) considered globally reachable

2021-05-18 Thread Martijn Pieters
Martijn Pieters added the comment: This is related to #42937, the IPv4 private network list is not considering the whole of 192.0.0.0/24 to be private. RFC 5736 / 6890 reserved 192.0.0.0/24 for special purposes (private networks) and to date a few subnets of that network have received

[issue42937] 192.0.0.8 (IPv4 dummy address) considered globally reachable

2021-05-18 Thread Martijn Pieters
Martijn Pieters added the comment: Oops, I got my issue numbers mixed up. This is related to #44167, I meant. -- ___ Python tracker <https://bugs.python.org/issue42

[issue44167] ipaddress.IPv6Address.is_private makes redundant checks

2021-05-18 Thread Martijn Pieters
Change by Martijn Pieters : -- keywords: +patch pull_requests: +24826 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26209 ___ Python tracker <https://bugs.python.org/issu

[issue42937] 192.0.0.8 (IPv4 dummy address) considered globally reachable

2021-05-18 Thread Martijn Pieters
Martijn Pieters added the comment: > Private is a subset of special use. Should a "_special_use" constant be > created. This would include multicast, link_local, private_use, and a few > more. There are already dedicated tests for those other special use networks in i

[issue35278] [security] directory traversal in tempfile prefix

2019-11-09 Thread Martijn Pieters
Martijn Pieters added the comment: I found this issue after helping someone solve a Stack Overflow question at https://stackoverflow.com/q/58767241/100297; they eventually figured out that their prefix was a path, not a path element. I'd be all in favour of making tempfile._sanitize_p

[issue36077] Inheritance dataclasses fields and default init statement

2019-12-05 Thread Martijn Pieters
Martijn Pieters added the comment: I've supported people hitting this issue before (see https://stackoverflow.com/a/53085935/100297, where I used a series of mixin classes to make use of the changing MRO when the mixins share base classes, to enforce a field order from inherited cl

[issue40647] Building with a libreadline.so located outside the ld.so.conf search path fails

2020-05-16 Thread Martijn Pieters
New submission from Martijn Pieters : This issue goes back a long time. The libreadline handling in the modules setup.py doesn't add the location of the readline library to the runtime library paths: self.add(Extension('readline', ['readline.c'],

[issue40647] Building with a libreadline.so located outside the ld.so.conf search path fails

2020-05-16 Thread Martijn Pieters
Martijn Pieters added the comment: Actually, this won't do it either, as `self.lib_dirs` already contains the --prefix. Clearly, I just need to add -R=${PREFIX}/lib to CPPFLAGS. -- resolution: -> not a bug ___ Python tracker

[issue40647] Building with a libreadline.so located outside the ld.so.conf search path fails

2020-05-16 Thread Martijn Pieters
Martijn Pieters added the comment: Last but not least, this is essentially a duplicate of https://bugs.python.org/issue4010 -- ___ Python tracker <https://bugs.python.org/issue40

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2020-09-08 Thread Martijn Pieters
Martijn Pieters added the comment: Might it be better to just *drop* the AutoProxy object altogether? All that it adds is a delayed call to MakeProxyType(f"AutoProxy[{typeid}]", exposed) (with exposed defaulting to public_methods(instance)), per instance per process. It could b

[issue37469] Make it explicit that logging QueueHandler / QueueListener accepts a SimpleQueue.

2019-07-01 Thread Martijn Pieters
New submission from Martijn Pieters : The implementation of the logging.handler.QueueHandler and logging.handler.QueueListener does not make use of the task tracking API of queues (queue.task_done(), queue.join()) nor does it care if the queue is unbounded (queue.full(), catching the Full

[issue37470] Make it explicit what happens when using a bounded queue with QueueHandler

2019-07-01 Thread Martijn Pieters
New submission from Martijn Pieters : The documentation doesn't make it explicit what happens if you use a bounded queue together with logging.handlers.QueueHandler. If the queue is bounded in size and attempts are made to add logrecords faster than a queue listener removes them, the

[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-09 Thread Martijn Pieters
New submission from Martijn Pieters: SyntaxError.__init__() checks for the `print` and `exec` error cases where the user forgot to use parentheses: >>> exec 1 File "", line 1 exec 1 ^ SyntaxError: Missing parentheses in call to 'exec' >>>

[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-09 Thread Martijn Pieters
Martijn Pieters added the comment: Credit for uncovering this gem: https://stackoverflow.com/questions/45591883/why-is-an-indentionerror-being-raised-here-rather-than-a-syntaxerror -- ___ Python tracker <http://bugs.python.org/issue31

[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-10 Thread Martijn Pieters
Martijn Pieters added the comment: It's confusing; a syntax error reports on the first error found, not two errors at once. The TabError or IndentationError exception detail message itself is lost (it should be "IndentationError: Improper mixture of spaces and tabs." or &quo

[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-13 Thread Martijn Pieters
Martijn Pieters added the comment: This does not increase clarity. It creates confusion. There are two distinct syntax errors, and they should be reported separately, just like `print "abc" 42` is two syntax errors; you'll hear about the second one once the fir

[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-13 Thread Martijn Pieters
Martijn Pieters added the comment: Disregard my last message, I misread Serhiy's sentence (read 'correct' for 'incorrect'). -- ___ Python tracker <http:

[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-13 Thread Martijn Pieters
Changes by Martijn Pieters : -- pull_requests: +3124 ___ Python tracker <http://bugs.python.org/issue31161> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31161] Only check for print and exec parentheses cases for SyntaxError, not subclasses

2017-08-13 Thread Martijn Pieters
Changes by Martijn Pieters : -- pull_requests: +3125 ___ Python tracker <http://bugs.python.org/issue31161> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35366] Monkey Patching class derived from ctypes.Union doesn't work

2018-11-30 Thread Martijn Pieters
Martijn Pieters added the comment: This is a repeat of old-tracker issue 1700288, see https://github.com/python/cpython/commit/08ccf202e606a08f4ef85df9a9c0d07e1ba1#diff-998bfefaefe2ab83d5f523e18f158fa4, which fixed this for StructType_setattro but failed to do the same for

[issue35547] email.parser / email.policy does correctly handle multiple RFC2047 encoded-word tokens across RFC5322 folded headers

2018-12-20 Thread Martijn Pieters
New submission from Martijn Pieters : The From header in the following email headers is not correctly decoded; both the subject and from headers contain UTF-8 encoded data encoded with RFC2047 encoded-words, in both cases a multi-byte UTF-8 codepoint has been split between the two encoded

[issue35547] email.parser / email.policy does correctly handle multiple RFC2047 encoded-word tokens across RFC5322 folded headers

2018-12-20 Thread Martijn Pieters
Change by Martijn Pieters : -- components: +email nosy: +barry, r.david.murray type: -> behavior versions: +Python 3.7 ___ Python tracker <https://bugs.python.org/issu

[issue35547] email.parser / email.policy does correctly handle multiple RFC2047 encoded-word tokens across RFC5322 folded headers

2018-12-20 Thread Martijn Pieters
Martijn Pieters added the comment: Right, re-educating myself on the MIME RFCs, and found https://bugs.python.org/issue1372770 where the same issue is being discussed for previous incarnations of the email library. Removing the FWS after CRLF is the wrong thing to do, **unless** RFC2047

[issue35547] email.parser / email.policy does correctly handle multiple RFC2047 encoded-word tokens across RFC5322 folded headers

2018-12-20 Thread Martijn Pieters
Martijn Pieters added the comment: That regex is incorrect, I should not post untested code from a mobile phone. Corrected workaround with more context: import re from email.policy import EmailPolicy class UnfoldingEncodedStringHeaderPolicy(EmailPolicy): def header_fetch_parse(self

[issue35547] email.parser / email.policy does not correctly handle multiple RFC2047 encoded-word tokens across RFC5322 folded headers

2018-12-21 Thread Martijn Pieters
Martijn Pieters added the comment: While RFC2047 clearly states that an encoder MUST not split multi-byte encodings in the middle of a character (section 5, "Each 'encoded-word' MUST represent an integral number of characters. A multi-octet character may not be split

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-03 Thread Martijn Pieters
New submission from Martijn Pieters : Currently, the sorting HOWTO at https://docs.python.org/3/howto/sorting.html#odd-and-ends contains the text: > The sort routines are guaranteed to use __lt__() when making comparisons > between two objects. So, it is easy to add a standard sort or

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-04 Thread Martijn Pieters
Martijn Pieters added the comment: Well, if this is indeed by design (and I missed the list.sort() reference) then I agree the HOWTO should not be changed! I'd be happy to change this to asking for more explicit mentions in the docs for sorted, heapq and bisect that using only < (__

[issue35654] Remove 'guarantee' that sorting only relies on __lt__ from sorting howto

2019-01-04 Thread Martijn Pieters
Martijn Pieters added the comment: (I have no opinion on this having to be a language feature however) -- ___ Python tracker <https://bugs.python.org/issue35

[issue35805] email package folds msg-id identifiers using RFC2047 encoded words where it must not

2019-01-22 Thread Martijn Pieters
New submission from Martijn Pieters : When encountering identifier headers such as Message-ID containing a msg-id token longer than 77 characters (including the <...> angle brackets), the email package folds that header using RFC 2047 encoded words, e.g. Mess

[issue36002] configure --enable-optimizations with clang fails to detect llvm-profdata

2019-02-15 Thread Martijn Pieters
New submission from Martijn Pieters : This is probably a automake bug. When running CC=clang CXX=clang++ ./configure --enable-optimizations, configure tests for a non-existing -llvm-profdata binary: checking for --enable-optimizations... yes checking for --with-lto... no checking for -llvm

[issue30154] subprocess.run with stderr connected to a pipe won't timeout when killing a never-ending shell commanad

2017-04-24 Thread Martijn Pieters
New submission from Martijn Pieters: You can't time out a process tree that includes a never-ending process, *and* which redirects stderr: cat >test.sh< /dev/null # never-ending EOF chmod +x test.sh python -c "import subprocess; subprocess.run(['./test.sh'], stderr=

[issue30154] subprocess.run with stderr connected to a pipe won't timeout when killing a never-ending shell commanad

2017-04-24 Thread Martijn Pieters
Martijn Pieters added the comment: Apologies, I copied the wrong sleep 10 demo. The correct demo is: cat >test.sh< #!/bin/sh > sleep 10 > EOF time bin/python -c "import subprocess; subprocess.run(['./test.sh'], stderr=subprocess.PIPE, timeout=3)" Traceback

[issue30293] Peephole binops folding can lead to memory and bytecache ballooning

2017-05-06 Thread Martijn Pieters
New submission from Martijn Pieters: The following expression produces 127MB in constants in `co_consts` due to two 63.5MB integer objects produced when folding: ((200*200 - 2) & ((1 << 5) - 1)) + ((200*200 - 2) >> 5) The optimizer already does not

[issue30293] Peephole binops folding can lead to memory and bytecache ballooning

2017-05-09 Thread Martijn Pieters
Martijn Pieters added the comment: Thanks Raymond, for the response. I agree, we can't prevent all possible misuse, and avoiding the memory issue would require overly costly checks as to what is being multiplied or added. -- ___ Python tr

[issue30524] iter(classmethod, sentinel) broken for Argument Clinic class methods?

2017-05-31 Thread Martijn Pieters
New submission from Martijn Pieters: I'm not sure where exactly the error lies, but issue 27128 broke iter() for Argument Clinic class methods. The following works in Python 3.5, but not in Python 3.6: from datetime import datetime from asyncio import Task next(iter(datetime.now, None))

[issue30524] iter(classmethod, sentinel) broken for Argument Clinic class methods?

2017-05-31 Thread Martijn Pieters
Martijn Pieters added the comment: Forgot to addthis: this bug was found via https://stackoverflow.com/questions/44283540/iter-not-working-with-datetime-now -- ___ Python tracker <http://bugs.python.org/issue30

[issue12169] Factor out common code for d2 commands register, upload and upload_docs

2019-03-04 Thread Martijn Pieters
Change by Martijn Pieters : -- pull_requests: +12166 ___ Python tracker <https://bugs.python.org/issue12169> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36188] Remove vestiges of Python 2 unbound methods from Python 3

2019-03-04 Thread Martijn Pieters
New submission from Martijn Pieters : The implementation of method_hash, method_call and method_descr_get all still contain assumptions that __self__ can be set to None, a holdover from Python 2 where methods could be *unbound*. These vestiges can safely be removed, because method_new() and

[issue36188] Remove vestiges of Python 2 unbound methods from Python 3

2019-03-04 Thread Martijn Pieters
Change by Martijn Pieters : -- keywords: +patch pull_requests: +12167 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36188> ___ _

[issue12169] Factor out common code for d2 commands register, upload and upload_docs

2019-03-04 Thread Martijn Pieters
Change by Martijn Pieters : -- pull_requests: -12166 ___ Python tracker <https://bugs.python.org/issue12169> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12169] Factor out common code for d2 commands register, upload and upload_docs

2019-03-04 Thread Martijn Pieters
Change by Martijn Pieters : -- pull_requests: +12168 ___ Python tracker <https://bugs.python.org/issue12169> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32836] Symbol table for comprehensions (list, dict, set) still includes temporary _[1] variable

2018-02-12 Thread Martijn Pieters
New submission from Martijn Pieters : In Python 2.6, a list comprehension was implemented in the current scope using a temporary _[1] variable to hold the list object: >>> import dis >>> dis.dis(compile('[x for x in y]', '?', 'exec')) 1

[issue32963] Python 2.7 tutorial claims source code is UTF-8 encoded

2018-02-27 Thread Martijn Pieters
New submission from Martijn Pieters : Issue #29381 updated the tutorial to clarify #! use, but the 2.7 patch re-used Python 3 material that doesn't apply. See r40ba60f6 at https://github.com/python/cpython/commit/40ba60f6bf2f7192f86da395c71348d0fa24da09 It now reads: "By defau

[issue32963] Python 2.7 tutorial claims source code is UTF-8 encoded

2018-02-27 Thread Martijn Pieters
Change by Martijn Pieters : -- nosy: +Mariatta, rhettinger ___ Python tracker <https://bugs.python.org/issue32963> ___ ___ Python-bugs-list mailing list Unsub

[issue32963] Python 2.7 tutorial claims source code is UTF-8 encoded

2018-03-03 Thread Martijn Pieters
Martijn Pieters added the comment: Thanks for the quick fix, sorry I didn't have a PR for this one! -- ___ Python tracker <https://bugs.python.org/is

[issue33492] Updating the Evaluation order section to cover *expression in calls

2018-05-14 Thread Martijn Pieters
New submission from Martijn Pieters : Can the *Evaluation order* (_evalorder) section in reference/expressions.rst please be updated to cover this exception in a *call* primary (quoting from the _calls section): A consequence of this is that although the ``*expression`` syntax may appear

[issue33516] unittest.mock: Add __round__ to supported magicmock methods

2018-05-15 Thread Martijn Pieters
New submission from Martijn Pieters : I notice that __trunc__, __floor__ and __ceil__ are supported methods for MagicMock, but __round__ (in the same grouping of numeric types emulation methods, see https://docs.python.org/3/reference/datamodel.html#object.__round__), is not. Please add this

[issue32112] Should uuid.UUID() accept another UUID() instance?

2017-11-22 Thread Martijn Pieters
New submission from Martijn Pieters : When someone accidentally passes in an existing uuid.UUID() instance into uuid.UUID(), an attribute error is thrown because it is not a hex string: >>> import uuid >>> value = uuid.uuid4() >>> uuid.UUID(value) Traceback (mos

[issue33567] Explicitly mention bytes and other buffers in the documentation for float()

2018-05-18 Thread Martijn Pieters
New submission from Martijn Pieters : float(bytesobject) treats the contents of the bytesobject as a sequence of ASCII characters, and converts those to a float value as if you used float(bytesobject.decode('ASCII')). The same support is extended to other objects implementing

[issue26832] ProactorEventLoop doesn't support stdin/stdout nor files with connect_read_pipe/connect_write_pipe

2018-09-11 Thread Martijn Pieters
Martijn Pieters added the comment: I'm trying to figure out why Windows won't let us do this. I think the reason is that sys.std(in|out) filehandles are not opened as pipes, and do not have the required OVERLAPPED flag set (see the CreateIoCompletionPort documentation

[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-03 Thread Martijn Pieters
Martijn Pieters added the comment: Why is the `formatter` module still part of Python 3? This was a dependency for the `htmllib` module in Python 2 only, and that module was deprecated and removed from Python 3. -- nosy: +mjpieters ___ Python

[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-12 Thread Martijn Pieters
Martijn Pieters added the comment: > The formatter module was deprecated? When? It wasn't, that's the point I am raising. The `formatter` module was exclusively used by the `htmllib` module, I am surprised the `formatter` module wasn't part o

[issue14385] Support other types than dict for __builtins__

2012-09-01 Thread Martijn Pieters
Martijn Pieters added the comment: I note that the documentation still states a dictionary is required for globals. Should that not be updated as well? See http://docs.python.org/py3k/library/functions.html#exec -- nosy: +mjpieters ___ Python

[issue14385] Support other types than dict for __builtins__

2012-09-01 Thread Martijn Pieters
Martijn Pieters added the comment: Apologies, I meant to link to the dev docs: http://docs.python.org/dev/library/functions.html#exec -- ___ Python tracker <http://bugs.python.org/issue14

[issue21746] urlparse.BaseResult no longer exists

2014-06-13 Thread Martijn Pieters
Martijn Pieters added the comment: Note that the Python 3 docs also need updating, but need a more extensive patch: https://docs.python.org/3/library/urllib.parse.html#structured-parse-results -- nosy: +mjpieters ___ Python tracker <h

[issue16937] -u (unbuffered I/O) command line option documentation mismatch for sys.stdin

2013-01-11 Thread Martijn Pieters
New submission from Martijn Pieters: Run `python3.3 -h` and the `-u` option is documented as: > -u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x > see man page for details on internal buffering relating to '-u' Note that only `stdout`

[issue19030] inspect.getmembers and inspect.classify_class_attrs mishandle descriptors

2013-09-27 Thread Martijn Pieters
Martijn Pieters added the comment: Note: there is a comment explaining the point of _RouteClassAttributeToGetattr right above the Enum.name and Enum.value methods you changed (now at line 474). You may want to update that comment now. -- nosy: +mjpieters

[issue21789] Broken link to PEP 263 in Python 2.7 error message

2014-07-12 Thread Martijn Pieters
Martijn Pieters added the comment: The *redirect* should be corrected here too! http://www.python.org/peps/pep-0263.html is still going to be in use for some time to come, a simple redirect *on Python.org* to the correct location would be helpful. -- nosy: +mjpieters

[issue21789] Broken link to PEP 263 in Python 2.7 error message

2014-07-13 Thread Martijn Pieters
Martijn Pieters added the comment: Yeah, I should have thought of that in the first place. Done, and thanks, Ned! -- ___ Python tracker <http://bugs.python.org/issue21

[issue3473] In function call, keyword arguments could follow *args

2014-08-27 Thread Martijn Pieters
Martijn Pieters added the comment: The documentation change in this patch introduced a bug in the Call grammar: | "*" `expression` ["," "*" `expression`] ["," "**" `expression`] instead of | "*" `expression` ["," `k

[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters
New submission from Martijn Pieters: The changes for issue #3473 introduced a documentation bug. The Call expression grammar implies that f(*[1, 2], *[3, 4]) is allowed: | "*" `expression` ["," "*" `expression`] ["," "**" `expression`]

[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters
Martijn Pieters added the comment: Proposed fix added in my fork. -- hgrepos: +270 ___ Python tracker <http://bugs.python.org/issue22288> ___ ___ Python-bug

[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters
Changes by Martijn Pieters : -- keywords: +patch Added file: http://bugs.python.org/file36487/ffe77dc2979a.diff ___ Python tracker <http://bugs.python.org/issue22

[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters
Changes by Martijn Pieters : Removed file: http://bugs.python.org/file36487/ffe77dc2979a.diff ___ Python tracker <http://bugs.python.org/issue22288> ___ ___ Python-bug

[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters
Martijn Pieters added the comment: Sigh, patch creation fails against a remove repository; I guess this only works for the default branch. Attached as a patch file instead. -- Added file: http://bugs.python.org/file36488/issue22288.patch ___ Python

[issue22288] Incorrect Call grammar in documentation

2014-08-27 Thread Martijn Pieters
Changes by Martijn Pieters : -- hgrepos: -270 ___ Python tracker <http://bugs.python.org/issue22288> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22288] Incorrect Call grammar in documentation

2014-08-28 Thread Martijn Pieters
Martijn Pieters added the comment: Fixed by revision 3ae399c6ecf6 -- resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.org/i

[issue22575] bytearray documentation confuses string for unicode objects

2014-10-07 Thread Martijn Pieters
New submission from Martijn Pieters: The Python 2 version of the bytearray() documentation appears to be copied directly from its Python 3 counterpart and states that when passing in a string an encoding is required: * If it is a string, you must also give the encoding (and optionally, errors

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-12 Thread Martijn Pieters
Martijn Pieters added the comment: I'm not sure if issues are linked automatically yet. I put the patch up as a pull request on GitHub: https://github.com/python/cpython/pull/51 -- ___ Python tracker <http://bugs.python.org/is

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-14 Thread Martijn Pieters
Changes by Martijn Pieters : -- pull_requests: +57 ___ Python tracker <http://bugs.python.org/issue28598> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-27 Thread Martijn Pieters
Changes by Martijn Pieters : -- pull_requests: +294 ___ Python tracker <http://bugs.python.org/issue28598> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-27 Thread Martijn Pieters
Changes by Martijn Pieters : -- pull_requests: +299 ___ Python tracker <http://bugs.python.org/issue28598> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-28 Thread Martijn Pieters
Martijn Pieters added the comment: > Is 2.7 free from this bug? No, 2.7 is affected too: >>> class SubclassedStr(str): ... def __rmod__(self, other): ... return 'Success, self.__rmod__({!r}) was called'.format(other) ... >>> 'lhs %% %r

[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-03-01 Thread Martijn Pieters
Changes by Martijn Pieters : -- pull_requests: +318 ___ Python tracker <http://bugs.python.org/issue28598> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27797] ASCII file with UNIX line conventions and enough lines throws SyntaxError when ASCII-compatible codec is declared

2016-08-19 Thread Martijn Pieters
New submission from Martijn Pieters: To reproduce, create an ASCII file with > io.DEFAULT_BUFFER_SIZE bytes (can be blank lines) and *UNIX line endings*, with the first two lines reading: #!/usr/bin/env python # -*- coding: cp1252 -*- Try to run this as a script on Windows:

[issue17949] operator documentation mixup

2013-05-10 Thread Martijn Pieters
New submission from Martijn Pieters: Rev 83684 (http://hg.python.org/cpython/rev/5885c02120f0) managed to move the `attrgetter()` `versionadded` and `versionchanged` notes down to the `itemgetter()` documentation instead, by moving the `itemgetter()` signature *up* above these lines. Now the

[issue16523] attrgetter and itemgetter signatures in docs need cleanup

2013-05-10 Thread Martijn Pieters
Martijn Pieters added the comment: The 2.7 patch shifted the `itemgetter()` signature to above the `attrgetter()` change and new notes. New patch to fix that in issue #17949: http://bugs.python.org/issue17949 -- nosy: +mjpieters ___ Python tracker

[issue13769] json.dump(ensure_ascii=False) return str instead of unicode

2014-10-23 Thread Martijn Pieters
Martijn Pieters added the comment: I'd say this is a bug in the library, not the documentation. The library varies the output type, making it impossible to use `json.dump()` with a `io.open()` object as the library will *mix data type* when writing. That is *terrible* beha

[issue22755] contextlib.closing documentation should use a new example

2014-10-28 Thread Martijn Pieters
New submission from Martijn Pieters: urllib.request.urlopen() now always produces a context manager (either a HTTPResponse or addinfourl object). The example for contextlib.closing still uses urllib.request.urlopen as an example for the context manager wrapper, see https://docs.python.org

[issue17876] Doc issue with threading.Event

2014-12-16 Thread Martijn Pieters
Martijn Pieters added the comment: I notice that the same issue still exists in the 3.5 documentation. Surely this can at least be fixed in the development copy? -- nosy: +mjpieters ___ Python tracker <http://bugs.python.org/issue17

[issue17876] Doc issue with threading.Event

2014-12-16 Thread Martijn Pieters
Martijn Pieters added the comment: Ah! Mea Culpa, you are correct. The issue is then with Python 2.7 only for which no doubt exists a separate ticket. -- ___ Python tracker <http://bugs.python.org/issue17

[issue7334] ElementTree: file locking in Jython 2.5 (OSError on Windows)

2015-01-22 Thread Martijn Pieters
Martijn Pieters added the comment: Indeed, the 2.7 backport was not correctly applied for _elementtree.c, leaving files open because the close_source flag is set to False *again* when opening a filename. Should a new issue be opened or should this ticket be re-opened? -- nosy

[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2015-08-10 Thread Martijn Pieters
Martijn Pieters added the comment: I don't understand why encoding with `surrogateescape` isn't supported still; is it the fact that a surrogate would have to produce *single bytes* rather than double? E.g. b'\x80' -> '\udc80' -> b'\x80' doesn'

[issue24856] Mock.side_effect as iterable or iterator

2015-08-13 Thread Martijn Pieters
New submission from Martijn Pieters: The documentation states that `side_effect` can be set to an [iterable](https://docs.python.org/3/glossary.html#term-iterable): > If you pass in an iterable, it is used to retrieve an iterator which must > yield a value on every call. This value can

[issue24856] Mock.side_effect as iterable or iterator

2015-08-13 Thread Martijn Pieters
Martijn Pieters added the comment: Bugger, that's the last time I take someone's word for it and not test properly. Indeed, I missed the inheritance of NonCallableMock, so the property is inherited from there. Mea Culpa! -- ___ Pyth

[issue26449] Tutorial on Python Scopes and Namespaces uses confusing 'read-only' terminology

2016-02-27 Thread Martijn Pieters
New submission from Martijn Pieters: >From the 9.2. Python Scopes and Namespace section: > If a name is declared global, then all references and assignments go directly > to the middle scope containing the module’s global names. To rebind variables > found outside of the innermos

[issue26449] Tutorial on Python Scopes and Namespaces uses confusing 'read-only' terminology

2016-02-27 Thread Martijn Pieters
Changes by Martijn Pieters : -- assignee: -> docs@python components: +Documentation nosy: +docs@python ___ Python tracker <http://bugs.python.org/issu

[issue26449] Tutorial on Python Scopes and Namespaces uses confusing 'read-only' terminology

2016-02-29 Thread Martijn Pieters
Martijn Pieters added the comment: +1 for "... can only be read". read-only can too easily be construed to mean that the variable cannot be set from *anywhere*, even the original scope. Another alternative would be "... is effectively read-only", but "... can

[issue26477] typing forward references and module attributes

2016-03-03 Thread Martijn Pieters
New submission from Martijn Pieters: Forward references to a module can fail, if the module doesn't yet have the required object. The "forward references" section names circular dependencies as one use for forward references, but the following example fails: $ cat test/__in

[issue26477] typing forward references and module attributes

2016-03-03 Thread Martijn Pieters
Martijn Pieters added the comment: Sorry, that should have read "the forward references section of PEP 484". The section uses this example: # File models/a.py from models import b class A(Model): def foo(self, b: 'b.B'): ... # File models/b.py from models import a cla

[issue26477] typing forward references and module attributes

2016-03-03 Thread Martijn Pieters
Martijn Pieters added the comment: A temporary work-around is to use a function to raise a NameError exception when the module attribute doesn't exist yet: def _forward_A_reference(): try: return a.A except AttributeError: # not yet.. raise NameError('

[issue26477] typing forward references and module attributes

2016-03-03 Thread Martijn Pieters
Martijn Pieters added the comment: > I wonder why they forward references are evaluated *at all* at this point. The Union type tries to reduce the set of allowed types by removing any subclasses (so Union[int, bool] becomes Union[int] only). That's all fine, but it should not at th

[issue26650] calendar: OverflowErrors for year == 1 and firstweekday > 0

2016-03-27 Thread Martijn Pieters
New submission from Martijn Pieters: For anything other than calendar.Calendar(0), many methods lead to OverflowError exceptions: >>> import calendar >>> c = calendar.Calendar(0) >>> list(c.itermonthdays(1, 1)) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,

[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?

2016-05-21 Thread Martijn Pieters
Changes by Martijn Pieters : -- nosy: +mjpieters ___ Python tracker <http://bugs.python.org/issue27078> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?

2016-05-21 Thread Martijn Pieters
Martijn Pieters added the comment: The catalyst for this question was a Stack Overflow question I answered: https://stackoverflow.com/questions/37365311/why-are-python-3-6-literal-formatted-strings-so-slow Compared the `str.format()` the BUILD_LIST is the bottleneck here; dropping the

  1   2   >