[issue46319] datetime.utcnow() should return a timezone aware datetime
Martin Panter added the comment: Perhaps this is a duplicate of Issue 12756? -- nosy: +martin.panter superseder: -> datetime.datetime.utcnow should return a UTC timestamp ___ Python tracker <https://bugs.python.org/issue46319> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46517] Review exception handling in urllib
Martin Panter added the comment: The linked code is for urllib.parse.urlencode, looking something like try: if len(query) and not isinstance(query[0], tuple): raise TypeError except TypeError: ty, va, tb = sys.exc_info() raise TypeError("not a valid non-string sequence " "or mapping object").with_traceback(tb) I guess it raises twice so that the error message is not duplicated in the code. The author probably also wants the TypeError initially raised from the "len(query)" and "query[0]" operations to get the same "not a valid . . ." message. Regarding the OSError, originally it was catching socket.error and raising IOError. I guess someone only wanted the caller to have catch IOError and not need to import the socket module. Later these exception types became aliases of each other. Anyway, the URLopener class is documented as deprecated, so is it really worth changing anything in that? -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue46517> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46738] Allow http.server to emit HTML 5
Change by Martin Panter : -- superseder: -> Generate HTML 5 with SimpleHTTPRequestHandler.list_directory ___ Python tracker <https://bugs.python.org/issue46738> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46756] Incorrect authorization check in urllib.request
Martin Panter added the comment: Maybe the same as Issue 42766? -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue46756> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46913] UBSAN: test_ctypes, test_faulthandler and test_hashlib are failing
Martin Panter added the comment: The ctypes overflow is probably the same as described in Issue 28169 and Issue 15119 -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue46913> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10278] add time.wallclock() method
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker <http://bugs.python.org/issue10278> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12922] StringIO and seek()
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker <http://bugs.python.org/issue12922> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4806] Function calls taking a generator as star argument can mask TypeErrors in the generator
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker <http://bugs.python.org/issue4806> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11944] Function call with * and generator hide exception raised by generator.
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker <http://bugs.python.org/issue11944> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4806] Function calls taking a generator as star argument can mask TypeErrors in the generator
Martin Panter added the comment: I haven’t tried to understand what the patches do, but Issue 5218 looks like a very similar problem with a patch including a test case. -- ___ Python tracker <http://bugs.python.org/issue4806> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5218] Check for tp_iter in ceval:ext_do_call before overriding exception message
Martin Panter added the comment: See also Issue 4806 -- nosy: +vadmium ___ Python tracker <http://bugs.python.org/issue5218> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11397] os.path.realpath() may produce incorrect results
Martin Panter added the comment: Another infinite loop that isn't caught in Python 3.2.1: With the symbolic link link => link/inside a readlink("link") call will keep looping. Anyhow, the proposed solution in issue11397_py32_2.patch does not account for paths with multiple independent references to the same link. Example link: here => . Calling readlink("here/here") for me should return "/media/disk/home/vadmium" (my current directory, containing the "here" link), but the proposed version returns an "/media/disk/home/vadmium/here/here" (incompletely resolved). I suggest something similar to "realpath_link_stack.py" I am attaching. I think the main difference is it pops each link off the cycle-detection stack after it has been resolved. -- nosy: +vadmium Added file: http://bugs.python.org/file22954/realpath_link_stack.py ___ Python tracker <http://bugs.python.org/issue11397> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12791] Yield" leaks exception being handled as garbage
New submission from Martin Panter : See attached "leaky_generator.py" demo. Python doesn't appear to delete the exception variable if an exception is thrown back into it (via "throw", "close" or by deleting it). The result is a reference cycle that needs garbage collecting. This even happens when no exception variable is named. The exception variable is not leaked if the generator is called normally (via "next" or "send"). The exception variable of an exception handler is usually deleted (according to http://docs.python.org/py3k/reference/compound_stmts.html#the-try-statement) as soon as the handler is exited, even when it is not exited by simply falling through the end. So either this should also happen for "yield" inside the exception handler, or it should be documented that "yield" inside "except", even without "as", should be avoided. I'm guessing this issue is specific to Python 3 because it exists for me in Python 3.2, 3.2.1 (both on Arch Linux) and 3.1.2 (Ubuntu) but not Python 2.7.1, 2.7.2 (Arch) nor 2.6.5 (Ubuntu). -- components: Interpreter Core files: leaky_generator.py messages: 142515 nosy: vadmium priority: normal severity: normal status: open title: Yield" leaks exception being handled as garbage type: resource usage versions: Python 3.1, Python 3.2 Added file: http://bugs.python.org/file22955/leaky_generator.py ___ Python tracker <http://bugs.python.org/issue12791> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34226] cgi.parse_multipart() requires undocumented CONTENT-LENGTH in Python 3.7
Martin Panter added the comment: Looks like the change causing this is revision cc3fa20. I would remove the reference to pdict['CONTENT-LENGTH']. -- keywords: +3.7regression nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue34226> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34915] LWPCookieJar.save() creates *.lwp file in 644 mode
Martin Panter added the comment: I don't have a strong opinion, but it does seem a sensible change that matches the high-level nature of the "cookiejar" module, with low risk of users relying on the current file permissions. On the other hand, the "curl" command seems to use the default mode when creating a cookies file (in Netscape a.k.a. Mozilla format): $ curl --cookie-jar cookies https://www.google.com/ [. . .] $ ls -l cookies -rw-r--r-- 1 vadmium vadmium 418 Mar 14 17:12 cookies The MozillaCookieJar class also seems to use the default file mode. I suppose it should be changed as well as the LWP class. -- components: -SSL ___ Python tracker <https://bugs.python.org/issue34915> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37788] fix for bpo-36402 (threading._shutdown() race condition) causes reference leak
Martin Panter added the comment: Anselm's pull request PR 15175 looked hopeful to me. I've been using those changes in our builds at work for a while. -- ___ Python tracker <https://bugs.python.org/issue37788> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44007] urlparse("host:123", "http") inconsistent between 3.8 and 3.9
Martin Panter added the comment: I suspect this comes from Issue 27657. Consider how similar URLs like tel:123 or javascript:123 should be parsed. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue44007> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44228] [urllib] Error with handling of urllib.parse.quote. Terminates halfway
Martin Panter added the comment: I presume this is because you are running a Unix shell, and it's nothing to do with Python. Look up how quoting and variable substitution with dollar signs $ works. $ set -o nounset $ python3 -c "import urllib.parse; print (urllib.parse.quote('ab$cd&efg#hij$klm'))" bash: cd: unbound variable Works fine in the Python interpreter: >>> import urllib.parse; print (urllib.parse.quote('ab$cd&efg#hij$klm')) ab%24cd%26efg%23hij%24klm -- nosy: +martin.panter resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue44228> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44146] Format string fill not handling brace char
Martin Panter added the comment: Another workaround: >>> '{:{brace}>10d}'.format(5, brace='{') '{5' -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue44146> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45170] tarfile missing cross-directory checking
Martin Panter added the comment: Issue 21109 has been open for a while and is the same as this, if I am not mistaken. -- nosy: +martin.panter resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> tarfile: Traversal attack vulnerability ___ Python tracker <https://bugs.python.org/issue45170> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45349] configparser.ConfigParser: 2 newlines at end of file (EOF)
Martin Panter added the comment: Looks like the same as Issue 32917. I presume there are two newlines at the end of the file because there are two newlines following every config section. IMO this is a minor cosmetic annoyance, just like writing a key with an empty value gets you a trailing space after the equals sign at the end of the line. Not worth changing as a bug fix, and not worth a special option, but maybe okay to change if the code is simple and it doesn't harm compatibility. -- nosy: +martin.panter resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> ConfigParser writes a superfluous final blank line ___ Python tracker <https://bugs.python.org/issue45349> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45523] Python3 ThreadingHTTPServer fails to send chunked encoded response
Martin Panter added the comment: Looks like you forgot to encode the length of ten in hexadecimal. I don't think the HTTP server module has any special handling for chunked responses, so this up to the user and isn't a bug in Python. -- nosy: +martin.panter resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue45523> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45585] Gzipping subprocess output produces invalid .gz file
Martin Panter added the comment: The subprocess module only uses the file object to get a file handle by calling the "fileno" method. See Issue 19992 about documenting this. For Python to compress the output of the child process, you would need a pipe. Gzip file objects provide the "fileno" method, but it just returns the underlying file descriptor. Data written to that file descriptor would normally already be compressed by Python and goes straight to the OS. There is also Issue 24358 opened about whether "fileno" should be implemented. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue45585> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29979] cgi.parse_multipart is not consistent with FieldStorage
Change by Martin Panter : -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue29979> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38831] urllib.request header characters being changed to lowercase
Martin Panter added the comment: I suggest to keep the discussion with Issue 12455 -- nosy: +martin.panter superseder: -> urllib2 forces title() on header names, breaking some requests ___ Python tracker <https://bugs.python.org/issue38831> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38710] unsynchronized write pointer in io.TextIOWrapper in 'r+' mode
Martin Panter added the comment: Previously Issue 12215 and a couple of other duplicates were opened about this. Writing after reading with TextIOWrapper doesn't work as people expect. The report was closed apparently because Victor thought there wasn't enough interest in it. FWIW the seek-then-write workaround will probably work for most common codecs, but would suffer the same problems discussed in Issue 26158 for codecs like UTF-7 and ISO-2022 that would need the encoder state constructed from the decoder state. -- nosy: +martin.panter superseder: -> TextIOWrapper: issues with interlaced read-write ___ Python tracker <https://bugs.python.org/issue38710> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37193] Memory leak while running TCP/UDPServer with socketserver.ThreadingMixIn
Martin Panter added the comment: Another workaround might be to set the new "block_on_close" flag (Issue 33540) to False on the server subclass or instance. Victor: Replying to <https://bugs.python.org/issue37193#msg345817> "What do I think of also using a weakref?", I assume you mean maintaining "_threads" as a WeakSet rather than a list object. That seems a nice way to solve the problem, but it seems redundant to me if other code such as Maru's proposal was also added to clean up the list. -- ___ Python tracker <https://bugs.python.org/issue37193> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37788] fix for bpo-36402 (threading._shutdown() race condition) causes reference leak
Change by Martin Panter : -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue37788> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37193] Memory leak while running TCP/UDPServer with socketserver.ThreadingMixIn
Martin Panter added the comment: FTR I have been trialling a patched Python 3.7 based on Maru's changes (revision 6ac217c) + review suggestions, and it has reduced the size of the leak (hit 1 GB over a couple days, vs only 60 MB increase over three days). The remaining leak could be explained by Issue 37788. -- ___ Python tracker <https://bugs.python.org/issue37193> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards
Martin Panter added the comment: Is there a recommended replacement for calculating CRC-CCITT? Do it yourself in Python code, or use a particular external module? -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue39353> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards
Martin Panter added the comment: Building and verifying the checksum in "RTA protocol" that uses this: <https://rms.nsw.gov.au/business-industry/partners-suppliers/documents/specifications/tsi-sp-003.pdf>. But I understand CRC-CCITT is one of the two popular 16-bit CRC polynomials, used in many other places, according to <https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Polynomial_representations_of_cyclic_redundancy_checks>. -- ___ Python tracker <https://bugs.python.org/issue39353> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards
Martin Panter added the comment: Of course I would prefer “crc_hqx” to stay, because we use it at work. But I understand if you think it is not popular enough to justify maintaining it. But I was more asking if the deprecation notice should point the way forward. This function is no longer recommended, so what should users do instead? Or at least explain why it is deprecated. In my case, I may eventually write or resurrect a simple Python CRC implementation that shifts one bit at a time. But other people may desire a faster C implementation. -- ___ Python tracker <https://bugs.python.org/issue39353> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards
Martin Panter added the comment: Thanks Victor -- ___ Python tracker <https://bugs.python.org/issue39353> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35318] Check accuracy of str() doc string for its encoding argument
Martin Panter added the comment: Closing in favour of Issue 39574 where a new wording is proposed -- nosy: +martin.panter resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> str.__doc__ is misleading ___ Python tracker <https://bugs.python.org/issue35318> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39717] Fix exception causes in tarfile module
Martin Panter added the comment: Please don’t use “from None” in library code. It hides exceptions raised by the calling application that would help debugging. E.g. <https://bugs.python.org/issue30097#msg293185> -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue39717> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39780] Add HTTP Response code 103
Martin Panter added the comment: See also Issue 39509, proposing to add 103 and "425 Too Early" -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue39780> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26527] CGI library - Using unicode in header fields
Martin Panter added the comment: I’m not an expert on the topic, but it sounds like this might be a duplicate of Issue 23434, which has more discussion. -- nosy: +martin.panter resolution: -> duplicate status: open -> pending superseder: -> support encoded filename in Content-Disposition for HTTP in cgi.FieldStorage ___ Python tracker <https://bugs.python.org/issue26527> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40299] os.dup seems broken with execvp (LINUX)
Martin Panter added the comment: The file descriptor created by "os.dup" is not inherited by child processes by default since Python 3.4. https://docs.python.org/3/library/os.html#os.dup Does it work if you use "os.set_inheritable" or "os.dup2" (which apparently sets it inhertiable by default)? -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue40299> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43050] threading timer memory leak
Martin Panter added the comment: Perhaps this is caused by Issue 37788. Python 3.7.4 introduced a leak for any thread that doesn't get its "join" method called. Timer is a subclass of Thread, so to confirm, see if calling "timer.join()" after "cancel" will make the leak go away. -- nosy: +martin.panter resolution: -> duplicate superseder: -> fix for bpo-36402 (threading._shutdown() race condition) causes reference leak type: performance -> resource usage ___ Python tracker <https://bugs.python.org/issue43050> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37788] fix for bpo-36402 (threading._shutdown() race condition) causes reference leak
Change by Martin Panter : -- keywords: +3.7regression ___ Python tracker <https://bugs.python.org/issue37788> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43375] memory leak in threading ?
Martin Panter added the comment: Sounds the same as Issue 37788, which is still open. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue43375> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43292] xml.ElementTree iterparse filehandle left open
Martin Panter added the comment: Perhaps this can be handled with Issue 25707, which is open for adding an API to close the file, similar to how "os.scandir" iterator implements a context manager and "close" method. -- nosy: +martin.panter superseder: -> Add the close method for ElementTree.iterparse() object ___ Python tracker <https://bugs.python.org/issue43292> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43292] xml.ElementTree iterparse filehandle left open
Change by Martin Panter : -- type: security -> resource usage ___ Python tracker <https://bugs.python.org/issue43292> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40657] Resource leaks with threading.Thread
Martin Panter added the comment: Perhaps this is the same as Issue 37788, introduced in 3.7. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue40657> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41254] Add to/from string methods to datetime.timedelta
Martin Panter added the comment: I don't know how much support this will get since there is already a str(timedelta) operation defined with a different format. But I don't like that format much. The day[s] part is too verbose, the H:MM:SS part could too easily be interpreted as D:HH:MM, and the result for negative deltas is horrible (-43 days, 23:59:55; see Issue 38701). My favourite format for a duration is usually the HTML 5 format like 1w 0d 12h 0m 27s Another option is ISO 8601 format: P1W0DT12H0M27S But both of these standards only go down to the seconds unit, so 50 ms has to be 0.05s or PT0.05S. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue41254> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18861] Problems with recursive automatic exception chaining
Change by Martin Panter : -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue18861> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41345] Remote end closed connection without response
Martin Panter added the comment: Previous report about Requests to the Python bug tracker: Issue 33620. I suspect this is an unavoidable race condition with trying a POST (or other non-idempotent) request on an idle HTTP connection. I think it has to be up to the higher-level application or user to decide if it is safe to retry a POST request. Otherwise you risk e.g. accidentally ordering two pizzas because the server received two POST requests but something interfered with the response of the first response. On the other hand, I noticed some browsers seem to automatically retry a POST once if it is interrupted, which makes me uneasy. A concrete example of the problem is a firmware upload that triggers a reboot. If the reboot is too quick and prevents the POST response being sent, I found that a web browser will repeat the firmware upload once more after my firmware boots up again. If it is not safe to retry the POST request, other options would be to avoid the server thinking the connection is stale: * always do the POST request on a fresh HTTP connection * "ping" the connection with a dummy request (e.g. OPTIONS, HEAD, or GET) immediately before the POST request Another option that comes to mind is to try using the 100 Continue mechanism, but this is not a general solution and depends on the application. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue41345> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41450] OSError is not documented in ssl library, but still can be thrown
Martin Panter added the comment: Issue 31122 is also open about fixing this long-term, but I agree it would be good to document this quirk / bug. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue41450> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41695] http.cookies.SimpleCookie.parse could not parse cookies when one cookie value is json
Martin Panter added the comment: Perhaps this is a duplicate of Issue 27674, where I think parsing is aborted when a double-quote is seen? -- nosy: +martin.panter superseder: -> Quote mark breaks http.cookies, Cookie.py processing ___ Python tracker <https://bugs.python.org/issue41695> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41767] KeyError exception is more difficult to read due to quoting
Martin Panter added the comment: Perhaps a duplicate of Issue 2651, closed because it was too hard to fix without breaking compatibility. -- nosy: +martin.panter superseder: -> Strings passed to KeyError do not round trip ___ Python tracker <https://bugs.python.org/issue41767> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42062] Usage of HTTPResponse.url
Martin Panter added the comment: There is a comment in the HTTPResponse class regarding these methods: # For compatibility with old-style urllib responses. They were there for the "urlopen" API in "urllib.request", not for the "http.client" module on its own. I expect the "url" attribute is set by the "urlopen" code. However more recently (Issue 12707) the "url" attribute and "geturl" method were documented in the HTTPResponse documentation, which is awkward. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue42062> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41983] Missing Documentation AF_PACKET
Martin Panter added the comment: According to the documentation at <https://docs.python.org/3.8/library/socket.html#socket.AF_PACKET> and Issue 25041 it is only available on Linux. What documentation are you looking at? -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue41983> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42094] isoformat() / fromisoformat() for datetime.timedelta
Martin Panter added the comment: There is related discussion in Issue 41254, about duration formats more generally. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue42094> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42263] Removing thread reference in thread results in leaked reference
Change by Martin Panter : -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue42263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42263] Removing thread reference in thread results in leaked reference
Martin Panter added the comment: Maybe this is related to (or duplicate of) Issue 37788? Python 3.7 has a regression where threads that are never joined cause leaks; previous code was written assuming you didn't need to join threads. Do you still see the leak even if you don't clear the "threads" list (change the target to a no-op), or if you never create a list in the first place? -- ___ Python tracker <https://bugs.python.org/issue42263> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3982] support .format for bytes
Changes by Martin Panter : -- nosy: +vadmium ___ Python tracker <http://bugs.python.org/issue3982> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37040] checking for membership in itertools.count enters infinite loop with no way to exit
Martin Panter added the comment: Problems with long-running iterators are already discussed in: Issue 31815: rejected proposal to check for interrupts Issue 33939: proposal to flag iterators as being infinite -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue37040> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37176] super() docs don't say what super() does
Martin Panter added the comment: Some of the problems brought up here (which sibling or subclass, and which parameter’s MRO) also came up a few years ago in Issue 23674. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue37176> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37290] Mistranslation (Japanese)
Change by Martin Panter : -- nosy: +cocoatomo title: Mistranslation -> Mistranslation (Japanese) ___ Python tracker <https://bugs.python.org/issue37290> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31233] socketserver.ThreadingMixIn leaks running threads after server_close()
Martin Panter added the comment: FYI the change here to remember all the thread objects ever created looks to be the cause of the memory leak reported in Issue 37193 -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue31233> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37193] Memory leak while running TCP/UDPServer with socketserver.ThreadingMixIn
Martin Panter added the comment: Looking at the code, this would be caused by Issue 31233. I expect 3.7+ is affected. 3.6 has similar code, but the leaking looks to be disabled by default. 2.7 doesn't collect a "_threads" list at all. Looks like Victor was aware of the leak when he changed the code: <https://bugs.python.org/issue31233#msg304619>, but maybe he pushed the code and then forgot about the problem. A possible problem with Norihiro's solution is modifying the "_threads" list from multiple threads without any synchronization. (Not sure if that is a problem, or is it guaranteed to be okay due to GIL etc?) Also, since the thread is removing itself from the list, it will still run a short while after the removal, so there is a window when the "server_close" method will not wait for that thread. Might also defeat the "dangling thread" accounting that I believe was Victor's motivation for his change. Wei's proposal is to check for cleaning up when a new request is handled. That relies on a new request coming in to free up memory. Perhaps we could use similar strategy to the Forking mixin, which I believe cleans up expired children periodically, without relying on a new request. -- keywords: +3.7regression nosy: +martin.panter, vstinner ___ Python tracker <https://bugs.python.org/issue37193> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37424] subprocess.run timeout does not function if shell=True and capture_output=True
Martin Panter added the comment: Same thing going on as in Issue 30154. The shell is probably spawning the “sleep” command as a child process (grandchild of Python), and waiting for it to exit. When Python times out, it will kill the shell process, leaving the grandchild as an orphan. The “sleep” process will still be running and probably holds the “stdout” and/or “stderr” pipes open, and Python will wait indefinitely to be sure it has captured all the output to those pipes. Also see Issue 26534 proposes APIs to kill a process group rather than the single child process. -- nosy: +martin.panter resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> subprocess.run with stderr connected to a pipe won't timeout when killing a never-ending shell commanad ___ Python tracker <https://bugs.python.org/issue37424> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37477] NamedTemporaryFile can hang on windows
Martin Panter added the comment: Perhaps a duplicate of Issue 22107? -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue37477> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue37477] NamedTemporaryFile can hang on windows
Change by Martin Panter : -- resolution: -> duplicate superseder: -> tempfile module misinterprets access denied error on Windows ___ Python tracker <https://bugs.python.org/issue37477> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27485] urllib.splitport -- is it official or not?
Martin Panter added the comment: I don't think it is worth changing the implementations to be in terms of urlsplit or urlparse. This is proposed for splithost in <https://github.com/python/cpython/pull/1849>, but I suspect it would change the behaviour in some corner cases. See Issue 22852 for some deficiencies with urlsplit. 3. Change existing usage to the internal _split functions, unless there is a reason (bug or security problem) to make further changes. -- ___ Python tracker <http://bugs.python.org/issue27485> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30669] json.tool does not accept an --indent flag
Martin Panter added the comment: Issue 29636 looks related -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue30669> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25026] (FreeBSD/OSX) Fix fcntl module to accept 'unsigned long' type commands for ioctl(2).
Martin Panter added the comment: Maybe Issue 16124 is related; it mentions 64-bit values, but it sounds like an obscure use case. -- ___ Python tracker <http://bugs.python.org/issue25026> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18140] urlparse, urlsplit confused when password includes fragment (#), query (?)
Changes by Martin Panter : -- dependencies: +[security] urllib connects to a wrong host ___ Python tracker <http://bugs.python.org/issue18140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30625] Documentation is unclear how "y*" and "y#" format units vary
Martin Panter added the comment: Issue 24009 proposes deprecating y# (among other units). IMO the documentation and error message aren’t specific enough regarding the reference to “bytes-like”. -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue30625> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30576] http.server should support HTTP compression (gzip)
Martin Panter added the comment: I think neither Pierre’s nor Glenn’s implementations should be added to SimpleHTTPRequestHandler. In fact I think most forms of content negotiation are only appropriate for a higher-level server. It seems too far removed from the intention of the class, “directly mapping the directory structure to HTTP requests”. Another concern with Pierre’s proposal is the delay and memory or disk usage that would be incurred for a large file (e.g. text/plain log file), especially with HEAD requests. I have Linux computers set up with /tmp just held in memory, no disk file system nor swap. It would be surprising that a HTTP request had to copy the entire file into memory before sending it. It may be reasonable to serve the Content-Encoding field based on the stored file though. If the client requests file “xyz”, there should be no encoding, but if the request was explicitly for “xyz.gz”, the server could add Content-Encoding. But I suspect this won’t help Pierre. Some other thoughts on the pull request: * x-gzip is supposed to be an alias in HTTP 1.1 requests * The response is HTTP 1.0, where x-gzip seems to be the canonical name * In HTTP 1.1 requests, consider supporting Accept-Encoding: gzip;q=1 * Accept-Encoding: gzip;q=0 * Accept-Encoding: * * Accept-Encoding: GZIP (case insensitivity) -- ___ Python tracker <http://bugs.python.org/issue30576> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24465] Make shutil.make_archive have deterministic sorting
Changes by Martin Panter : -- dependencies: +tarfile add uses random order title: Make tarfile have deterministic sorting -> Make shutil.make_archive have deterministic sorting ___ Python tracker <http://bugs.python.org/issue24465> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30716] Failing tests with installed 3.6.2rc1 on Win 10-64
Martin Panter added the comment: Sounds similar to Issue 27425. Did rc1 get built with mangled newlines or something? -- components: +Tests, Windows nosy: +martin.panter, paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker <http://bugs.python.org/issue30716> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30576] http.server should support HTTP compression (gzip)
Martin Panter added the comment: For existing “.gz” files, I wasn’t suggesting to compress them a second time, just for the server report that they are already compressed, like how it reports the Content-Type value based on the file name. Including Content-Encoding would help browsers display pages like <http://www.yoyodesign.org/outils/ngzip/index.en.html.gz>. -- ___ Python tracker <http://bugs.python.org/issue30576> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30754] textwrap.dedent mishandles empty lines
Martin Panter added the comment: Some people like to avoid indented blank lines, treating them the same as trailing whitespace. I suspect this behaviour may be intentional. -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue30754> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30302] Improve .__repr__ implementation for datetime.timedelta
Martin Panter added the comment: Don’t let my minus sign suggestion stop this, especially since a couple other people said they don’t like it. The current pull request proposal is beneficial without it. Isn’t there a “Unicode writer” API that could be used? Maybe that’s another alternative to the string accumulation or list building, but I never used it so it may not be appropriate. -- ___ Python tracker <http://bugs.python.org/issue30302> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6
Changes by Martin Panter : -- dependencies: +test_threading_handled() of test_socketserver hangs randomly on AMD64 FreeBSD 10.x Shared 3.6, test_threading_not_handled() of test_socketserver hangs randomly on AMD64 FreeBSD 10.x Shared 3.6 ___ Python tracker <http://bugs.python.org/issue30319> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30319] ConnectionResetError: [Errno 54] Connection reset by peer in socket.close on FreeBSD, Py 3.6
Martin Panter added the comment: I think fixing all affected calls to socket.close in the world (option 3) would be too much. I just added two new reports (Issue 30652 and Issue 30391) as dependencies. These are about testing socketserver.TCPServer. As an example, to fix the socket.close call there, I think the change would look like class TCPServer: def close_request(self, request): try: request.close() except ConnectionError: # Suppress asynchronous errors such as ECONNRESET on Free BSD pass Instead of that change all over the place, I am thinking option 2 would be safest. In Modules/socketmodule.c, something like sock_close(PySocketSockObject *s) { Py_BEGIN_ALLOW_THREADS res = SOCKETCLOSE(fd); Py_END_ALLOW_THREADS /* ECONNRESET can occur on Free BSD */ if (res < 0 && errno != ECONNRESET) { return s->errorhandler(); } } -- ___ Python tracker <http://bugs.python.org/issue30319> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30391] test_threading_handled() of test_socketserver hangs randomly on AMD64 FreeBSD 10.x Shared 3.6
Martin Panter added the comment: These tests are supposed to: 1. Create a TCP server 2. Open a TCP connection 3. Run a custom connection handler (depending on the particular test) in a new thread 4. When the handler returns, the new thread should call “shutdown_request” 5. Shutdown_request closes the server’s connection socket 6. Shutdown_request sets an event for the main thread 7. Main thread waits for the above event The stack trace indicates a thread is stuck at step 7. My guess is that step 5 has raised an exception, killing the thread rather than continuing to step 6. I suspect it is a “socket.close” call raising an asynchronous error such as ECONNRESET; see Issue 30319. A general fix for that problem might fix these test_socketserver hangs. -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue30391> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29926] IDLE: in shell, time.sleep ignores _thread.interrupt_main()
Martin Panter added the comment: I doubt the Gnu Readline library nor Python’s readline module are relevant. The input function only uses Readline if sys.stdin is the original stdin terminal; I suspect Idle monkey-patches sys.stdin. The readline method reads directly from the file object; it never uses the Readline library (despite the unfortunate clash in names :). Louie seems to have added two workarounds: the finish flag, and using interrupt_main with a timeout. Both seem racy. What if the flag is altered in another thread between when the flag is checked and when it is acted upon? What has to happen in the 0.2 s between calling interrupt_main and raising SIGINT? -- ___ Python tracker <http://bugs.python.org/issue29926> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30713] Reject newline character (U+000A) in URLs in urllib.parse
Martin Panter added the comment: It might help if you explained why you want to make these changes. Otherwise I have to guess. Is a compromise between strictly rejecting all non-URL characters (not just control characters), versus leaving it up to user applications to validate their URLs? I guess it could partially prevent some newline injection problems like Issue 29606 (FTP) and Issue 30458 (HTTP). But how do we know it closes more security holes than it opens? I don’t understand the focus on these three functions. They are undocumented and more-or-less deprecated (Issue 27485). Why not focus on the “urlsplit” and “urlparse” functions first? Some of the changes seem to go too far, e.g. in the splithost("//hostname/u\nrl") test case, the hostname is fine, but it is not recognized. This would partially conflict the patch in Issue 13359, with proposes to percent-encode newlines after passing through “splithost”. And it would make the URL look like a relative URL, which is a potential security hole and reminds me of the open redirect bug report (Issue 23505). -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue30713> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19613] test_nntplib: sporadic failures, test_article_head_body()
Martin Panter added the comment: It looks like I was fairly confident about my patch, but it was all theoretical and I was never able to analyze the failure myself. Sorry but I am unlikely to spend much time on this or open a pull request any time soon. -- ___ Python tracker <http://bugs.python.org/issue19613> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30319] Change socket.close() to ignore ECONNRESET
Martin Panter added the comment: Thanks for handling this Victor. To answer some of your earlier questions, this is my understanding of the Free BSD behaviour (although I don't have Free BSD to experiment with): When writing to TCP sockets, I believe the data is buffered by the local OS (as well as the network, remote peer, etc). The send call will normally return straight away. In the background, the OS might combine the data with existing buffers, send it to the network, wait for acknowledgements, retransmit it, etc. On Free BSD, steps to trigger ECONNRESET might be: 1. Establish a TCP connection. 2. Send some data to the remote peer. OS returns immediately without indicating if data will successfully be sent. 3. Remote receives data packet, but decides the connection is not valid, so responds with reset message. Maybe its socket was shut down, or the OS rebooted. 4. Close the local socket. If TCP reset message was received in time, Free BSD raises ECONNRESET. I understand ECONNRESET is an _indication_ that not all pending data was delivered. But this is asynchronous, and a lack of ECONNRESET does not guarantee that all pending data was delivered. Imagine if steps 3 and 4 were swapped above. I doubt Free BSD will block the close call until the data is acknowledged, so it won't know if the peer will reset the connection in the future. To guarantee the data was delivered to the application (not just the remote OS), you do need an application-level acknowledgement. For SSL, when you call the top-level SSLSocket.close, I don't think that does much at the SSL level. Again, if you need delivery indication, I would use an app-level acknowledgement. Also beware that by default, Python doesn't report a secure EOF signal sent from the remote peer, so I think you either need a specific app-level message, or should disable the suppress_ragged_eofs mode (see Issue 27815). Antoine: sorry for abusing the dependencies list; I will try to avoid that in the future. It seemed the easiest way to get a two-way link to a bunch of other bugs that could be duplicates, but I wasn't sure at the time. My theory was if this bug was fixed, someone could review those other bugs and see if they could also be closed. -- ___ Python tracker <http://bugs.python.org/issue30319> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27068] Add a detach() method to subprocess.Popen
Martin Panter added the comment: Personally, I haven’t needed this feature. But I still think it may be a decent solution for the “webbrowser” module, potentially your “asyncio” problem, and other cases that could now trigger an unwanted ResourceWarning. -- ___ Python tracker <http://bugs.python.org/issue27068> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30393] test_readline hangs
Martin Panter added the comment: Thanks for the information. That narrows the problem down, but I still don’t exactly know why it hangs. A good workaround may be to put a timeout in the “select” call for a second or so, and if it times out, raise an exception which will fail the test but let the rest of the tests continue. To add the timeout, I would change the code in “run_pty” to look like selected = sel.select(timeout=1) if not selected: raise Exception("Child timed out: remaining input {!r}, output {!r}".format( input, output)) for [_, events] in selected: ... This is what “test_auto_history_enabled” is supposed to do: 1. Create a pseudo-terminal with master and slave file descriptors 2. Spawn a child process to read from the slave and then print the test result to the slave 3. Parent waits to be able to read from or write to the PTY master 4. Parent writes the bytes b"dummy input\r" to the PTY 5. Child calls “input” which calls the Readline library and reads the input 6. Child writes the test result to the PTY slave 7. Parent reads the output from the child 8. Child closes its slave file descriptor and exits 9. On Linux, reading then raises EIO indicating all copies of the slave are closed and there is no more output left to read The parent is hanging at step 3, before entering step 4, 7, or 9. Some input may already have been written to the child, and some output may have been captured, but it assumes the child is still running and is waiting for it to exit, which should close the slave file descriptor. It would be interesting to confirm if the child has exited or is still waiting for the CR to terminate its input line. Or perhaps the slave file descriptor has somehow been duplicated in a third process without being closed. -- ___ Python tracker <http://bugs.python.org/issue30393> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29606] urllib FTP protocol stream injection
Martin Panter added the comment: Serhiy, that is what Dong-hee already proposed in <https://github.com/python/cpython/pull/1214>, but someone needs to decide if we want to support RFC 2640, in which I understand LF on its own is legal, and CR is escaped by adding a NUL. -- ___ Python tracker <http://bugs.python.org/issue29606> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31025] io.BytesIO: no way to get the length of the underlying buffer without copying data
Martin Panter added the comment: Can’t you use b.seek(0, SEEK_END)? -- nosy: +martin.panter versions: -Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker <http://bugs.python.org/issue31025> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30576] http.server should support HTTP compression (gzip)
Martin Panter added the comment: I think chunked encoding is only meant to be used for HTTP 1.1. For HTTP 1.0, you have to either send Content-Length, or shut down the connection after sending the body. See also Issue 21224 about improving HTTP 1.1 support. Maybe you should add a “Vary: accept-encoding” field (even if gzip not acceptable to the client). I wonder if it is possible to make some of the code more generic? E.g. rather than being coupled to SimpleHTTPRequestHandler, perhaps the chunk encoder, request parsing, etc could also be usable by custom servers. We already have one chunk encoder in “http.client” and an Accept-Encoding parser in “xmlrpc.server”. FWIW I think using GzipFile should be safe if done right. You would give it a custom writer class that accepted gzip-encoded chunks, added HTTP chunk encoding (for HTTP 1.1), and sent them to the client. IMO this is a more flexible way of doing a chunk encoder. -- ___ Python tracker <http://bugs.python.org/issue30576> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31076] http.server should correctly handle HTTP 1.1 responses without a content-length
Martin Panter added the comment: The trouble is you would also have to parse the Transfer-Encoding field, and have special logic for responses where Content-Length is not needed or irrelevant (certain combinations of method and status code). And even then you risk breaking rare or custom methods and status codes. All this seems complex and at the wrong layer. A server shouldn’t be parsing the header fields it just generated. Perhaps there could be a new HTTP 1.1 mode (separate from protocol_version) that still closed the connection by default, but had a clearer API for keeping the connection open that the programmer can use in the right circumstances. But I had this thought before (see Issue 21224), and it didn’t seem beneficial. What’s your use case? Why not just stick with HTTP 1.0, or update the server code to either close the connection or use chunked encoding? -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue31076> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31122] SSLContext.wrap_socket() throws OSError with errno == 0
Martin Panter added the comment: It might help if you explained what “atrocities” are happening on your network. Is there a proxy or man-in-the-middle (or the remote peer) that shuts down TCP connections? If so, perhaps this is similar to Issue 10808. From my memory, in that case an OS “recv” or “read” call returns zero to indicate a connection was shut down. Python and/or Open SSL correctly treats this as an error, but then assumes “errno” is valid. Perhaps Python should be raising SSLEOFError in this situation. Maybe also check the “suppress_ragged_eofs” setting, but I think that only affects later stages, after the handshake succeeds. -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue31122> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31136] raw strings cannot end with a backslash character r'\'
Martin Panter added the comment: What would your proposal do where an embedded backslash is currently valid? >>> print(r'Backslash apostrophe: \'.') Backslash apostrophe: \'. >>> r'\' # Comment or string?' "\\' # Comment or string?" -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue31136> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31158] test_pty: test_basic() fails randomly on Travis CI
Martin Panter added the comment: Checking for short writes is worthwhile, but in Issue 29070 it looks like Cornelius identified the main problem was short _reads_. See the parts of his patch to do with “_os_read_exactly” and related functions. -- nosy: +Cornelius Diekmann, martin.panter ___ Python tracker <http://bugs.python.org/issue31158> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1732367] Document the constants in the socket module
Martin Panter added the comment: Issue 13256 contains a patch documenting socket options, but was closed because the author lost interest. Issue 27409 is a proposal to list the symbols available without documenting what each one is for. -- dependencies: +Document and test new socket options, List socket.SO_*, SCM_*, MSG_*, IPPROTO_* symbols ___ Python tracker <http://bugs.python.org/issue1732367> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1732367] Document the constants in the socket module
Martin Panter added the comment: The general rule for documenting availability seems to be to only list the special cases. Many of the socket options are specified by Posix, and seem to be available on Linux, Windows, BSD and other OSes. If you say “Availability: Linux, Windows”, it could imply that the API is specific to those two platforms, and not available on Free BSD or other platforms in general. -- ___ Python tracker <http://bugs.python.org/issue1732367> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31192] "return await coro()" SyntaxError despite being "valid syntax" in PEP 492
Martin Panter added the comment: In 3.5, “await” is an ordinary identifier outside of “async def” functions. You have to use the “async def” syntax to enable it as a special keyword. >>> async def foo(): # “Async def” enables “await” as a keyword ... return await coro() # Valid syntax ... >>> async def coro(): pass ... >>> def await(c): ... c.close() # Avoid RuntimeWarning ... return "Called await({!r})".format(c) ... >>> def bar(): # Ordinary non-PEP-492 function ... return await (coro()) ... >>> bar() 'Called await()' -- nosy: +martin.panter resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue31192> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31262] Documentation Error
Martin Panter added the comment: Assuming this is about the Classes section in the tutorial, you seem to be going down the same track as <https://github.com/python/cpython/pull/2696> -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue31262> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31320] test_ssl logs a traceback
Martin Panter added the comment: Not sure if you just want to hide the presence of the exception and traceback. But regarding the exception itself (OSError with errno 0), this is not ideal. From memory, you tend to get this when the connection is shut down insecurely at the TCP level. A better exception would be SSLEOFError. Similar report in Issue 31122 (same wrap_socket → do_handshake chain). Probably also relevant: Issue 10808. -- nosy: +martin.panter ___ Python tracker <http://bugs.python.org/issue31320> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31360] argparse mutually_exclusive_group under add_argument_group fails if part of parent_processor
Martin Panter added the comment: Seems the same as two other open bugs: Issue 25882 and Issue 16807. -- nosy: +martin.panter resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> argparse help error: arguments created by add_mutually_exclusive_group() are shown outside their parent group created by add_argument_group() ___ Python tracker <http://bugs.python.org/issue31360> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31365] Multiplication issue with 16.1
Martin Panter added the comment: The floating-point numbers are only accurate to about 16 digits. You probably just found a value that cannot be exactly represented. https://docs.python.org/3.3/faq/design.html#why-are-floating-point-calculations-so-inaccurate -- nosy: +martin.panter resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue31365> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29396] Re-opening /dev/tty breaks readline
Martin Panter added the comment: I think the difference between Python 2 and 3 here is that Python 2’s file objects, including sys.stdin, wrap C library FILE objects, which is supported by the Readline library. However Python 3 has its own kind of file objects, independent of standard C and Readline. Python 3 only uses Readline if sys.stdin corresponds to the original C stdin FILE object. Perhaps Python 3 could support Readline with other file objects (or at least file descriptors), but I think that would be a new feature. -- nosy: +martin.panter type: -> enhancement ___ Python tracker <http://bugs.python.org/issue29396> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31366] Missing terminator option when using readline with socketserver.StreamRequestHandler
Martin Panter added the comment: The socket.makefile(newline=...) parameter only affects text mode, but StreamRequestHandler’s “rfile” attribute works in byte mode. You could call makefile or TextIOWrapper yourself, but neither of these options support reading null-terminated “lines” or packets. I think it would be best to implement this more generally, e.g. via Issue 1152248 or Issue 17083. Perhaps like the “asyncio.StreamReader.readuntil” or “telnetlib.Telnet.read_until” methods, rather than a stream configuration option. -- nosy: +martin.panter ___ Python tracker <https://bugs.python.org/issue31366> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com