[issue42094] isoformat() / fromisoformat() for datetime.timedelta

2020-10-20 Thread Martin Panter


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



[issue41983] Missing Documentation AF_PACKET

2020-10-17 Thread Martin Panter


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



[issue42062] Usage of HTTPResponse.url

2020-10-17 Thread Martin Panter


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



[issue41767] KeyError exception is more difficult to read due to quoting

2020-09-11 Thread Martin Panter


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



[issue41695] http.cookies.SimpleCookie.parse could not parse cookies when one cookie value is json

2020-09-02 Thread Martin Panter


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



[issue41450] OSError is not documented in ssl library, but still can be thrown

2020-07-31 Thread Martin Panter


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



[issue41345] Remote end closed connection without response

2020-07-27 Thread Martin Panter


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



[issue18861] Problems with recursive automatic exception chaining

2020-07-27 Thread Martin Panter


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



[issue41254] Add to/from string methods to datetime.timedelta

2020-07-09 Thread Martin Panter


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



[issue40657] Resource leaks with threading.Thread

2020-05-23 Thread Martin Panter


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



[issue40299] os.dup seems broken with execvp (LINUX)

2020-04-16 Thread Martin Panter


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



[issue26527] CGI library - Using unicode in header fields

2020-03-22 Thread Martin Panter

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



[issue39780] Add HTTP Response code 103

2020-02-27 Thread Martin Panter


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



[issue39717] Fix exception causes in tarfile module

2020-02-21 Thread Martin Panter

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



[issue35318] Check accuracy of str() doc string for its encoding argument

2020-02-07 Thread Martin Panter


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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-30 Thread Martin Panter


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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-24 Thread Martin Panter

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

2020-01-22 Thread Martin Panter


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

2020-01-22 Thread Martin Panter


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



[issue37193] Memory leak while running TCP/UDPServer with socketserver.ThreadingMixIn

2019-12-18 Thread Martin Panter


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



[issue37788] fix for bpo-36402 (threading._shutdown() race condition) causes reference leak

2019-12-18 Thread Martin Panter


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

2019-12-15 Thread Martin Panter


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



[issue38710] unsynchronized write pointer in io.TextIOWrapper in 'r+' mode

2019-11-17 Thread Martin Panter


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



[issue38831] urllib.request header characters being changed to lowercase

2019-11-17 Thread Martin Panter


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



[issue29979] cgi.parse_multipart is not consistent with FieldStorage

2019-11-17 Thread Martin Panter


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



[issue34226] cgi.parse_multipart() requires undocumented CONTENT-LENGTH in Python 3.7

2019-09-30 Thread Martin Panter


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



[issue37477] NamedTemporaryFile can hang on windows

2019-07-01 Thread Martin Panter


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



[issue37477] NamedTemporaryFile can hang on windows

2019-07-01 Thread Martin Panter


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



[issue37424] subprocess.run timeout does not function if shell=True and capture_output=True

2019-06-27 Thread Martin Panter

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



[issue37193] Memory leak while running TCP/UDPServer with socketserver.ThreadingMixIn

2019-06-16 Thread Martin Panter


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



[issue31233] socketserver.ThreadingMixIn leaks running threads after server_close()

2019-06-16 Thread Martin Panter


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



[issue37290] Mistranslation (Japanese)

2019-06-15 Thread Martin Panter


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



[issue37176] super() docs don't say what super() does

2019-06-08 Thread Martin Panter

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



[issue37040] checking for membership in itertools.count enters infinite loop with no way to exit

2019-05-25 Thread Martin Panter


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



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-10 Thread Martin Panter

Martin Panter  added the comment:

The “cmd” module doesn’t use “argparse” as far as I can see. You might have to 
provide more information or code for someone to make sense of or reproduce your 
bug.

Also, see Issue 14191 which added new “parse_[known]_intermixed_args” APIs in 
3.7, and have a look at Issue 15112, about intermixing options between 
particular kinds of positional parameters.

--
nosy: +martin.panter
status: open -> pending

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



[issue36760] subprocess.run fails with capture_output=True and stderr=STDOUT

2019-04-30 Thread Martin Panter

Martin Panter  added the comment:

Python 3.7 added the "capture_output" parameter, for Issue 32102. Before that 
change, you could use "subprocess.PIPE":

https://docs.python.org/3.6/library/subprocess.html#subprocess.run
“To [capture output], pass PIPE for the ‘stdout’ and/or ‘stderr’ arguments”

Since "capture_output" was added, it looks like you can still pass 
"subprocess.PIPE" on your own, but the documentation now only gives subtle 
hints that this might be supported. This was also brought up in Issue 33319.

--
nosy: +bbayles, martin.panter

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



[issue36726] Empty select() on windows gives error.

2019-04-25 Thread Martin Panter


Martin Panter  added the comment:

I think this is a duplicate of Issue 29256. Issue 25680 also discusses platform 
differences with no file descriptors.

--
nosy: +martin.panter
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Windows select() errors out when given no fds to select on, 
which breaks SelectSelector

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



[issue35824] http.cookies._CookiePattern modifying regular expressions

2019-04-25 Thread Martin Panter

Martin Panter  added the comment:

Test_http_cookies line 19 has the following test case:

{'data': 'keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"',
 'dict': {'keebler' : 'E=mc2; L="Loves"; fudge=\012;'},
 'repr': '',
 'output': 'Set-Cookie: keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"'}

This is similar to an example in the documentation:

>>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";')
>>> print(C)
Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;"

If you break parsing of this string in the “load” method, you break documented 
behaviour. The “http.cookie” module is documented to follow RFC 2109. I believe 
the strings are valid by RFC 2109, in which the value is allowed to use the 
HTTP “quoted-string” format.

--

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



[issue33017] Special set-cookie setting will bypass Cookielib

2019-04-25 Thread Martin Panter

Martin Panter  added the comment:

I think LCatro is saying that Python should accept the cookies and discard only 
the offending attributes. This makes sense to me and tends to agree with the 
specifications, but the three cases seem all seem unimportant to me.

PoC 1, Max-age:

>>> from urllib2 import Request
>>> from test.test_cookielib import FakeResponse
>>> cookies = CookieJar(DefaultCookiePolicy())
>>> request = Request('http://127.0.0.1/requests_test.php')
>>> cookies.extract_cookies(FakeResponse(()), request)  # Issue 12144
>>> cookies.make_cookies(FakeResponse(('Set-Cookie: test=123; max-age=a',)), 
>>> request)  # No cookies returned
[]

RFC 6265 says Max-age should be ignored if not does not start with a digit or 
minus sign: <https://tools.ietf.org/html/rfc6265#section-5.2.2>. Netscape did 
not specify Max-age at all. So I agree that the cookie should be retained.

PoC 2, Domain: You have to omit the equals sign to satisfy “v is None” and 
discard the cookie record, otherwise “v” is just an empty string '':

>>> cookies.make_cookies(FakeResponse(('Set-Cookie: test=123; domain=;',)), 
>>> request)  # v == ''
[Cookie(version=0, name='test', value='123', port=None, port_specified=False, 
domain='.', domain_specified=True, domain_initial_dot=False, path='/', 
path_specified=False, secure=False, expires=None, discard=True, comment=None, 
comment_url=None, rest={}, rfc2109=False)]
>>> cookies.make_cookies(FakeResponse(('Set-Cookie: test=123; domain;',)), 
>>> request)  # v is None
[]

RFC 6265 says both these cases should be treated the same, and recommends 
ignoring Domain in these cases.

PoC 3, Version:

>>> cookies.make_cookies(FakeResponse(('Set-Cookie: test=123; version=a;',)), 
>>> request)  # No cookies returned
[]

The Version attribute is only specified by RFC 2109. Since the IETF has 
obsoleted it, I suggest to deprecate RFC 2109 support in the Python module. 
That way, if a real problem is demonstrated, we can remove the parts that are 
causing the problem.

--
nosy: +martin.panter
priority: normal -> low

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



[issue12144] cookielib.CookieJar.make_cookies fails for cookies with 'expires' set

2019-04-25 Thread Martin Panter

Martin Panter  added the comment:

Karthikeyan, it looks like your test will pass even when the bug is not fixed. 
A test calling code that writes error message does not necessarily mean the 
test itself will fail, I don’t think.

I suggest you look at raising an exception when the UserWarning is triggered, 
and/or check that the expected cookie is returned with the right “expires” 
value.

--
nosy: +martin.panter

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



[issue1564508] RFC 2965 BaseCookie does not support "$Port"

2019-04-24 Thread Martin Panter

Martin Panter  added the comment:

The original report comes from <https://code.djangoproject.com/ticket/2806>. 
Anders was trying to parse a HTTP request Cookie field, something like:

BaseCookie('sessionid=a2be2e7debe71af8d88d350c4d14d768;$Path=/;$Domain=192.168.0.2;$Port="8000"')

The problem is that Cookie.py assumes names beginning with a dollar sign ($) 
are reserved attributes of a previous cookie-pair, rather than arbitrary cookie 
names. It is obvious that this was intended to support RFC 2965, although it is 
not documented. The module has a hard-coded list of reserved attribute names, 
and Port is not one of them.

IMO it would be better to treat (unknown) reserved attributes such as $Port as 
ordinary cookie names, and start a new “morsel”. Ignoring them would also be a 
better option than rejecting the whole cookie field. The dollar sign is valid 
for a cookie name (token) according to RFC 2109, RFC 6265, and the Netscape 
specification.

--
nosy: +martin.panter

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



[issue23930] http.cookies.SimpleCookie doesn't parse comma-only separated cookies correctly

2019-04-24 Thread Martin Panter


Change by Martin Panter :


--
resolution:  -> rejected
status: open -> pending

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



[issue23298] Add ArgumentParser.add_mutually_dependence_group

2019-04-24 Thread Martin Panter


Change by Martin Panter :


--
superseder:  -> Add "necessarily inclusive" groups to argparse

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



[issue22742] IDLE shows traceback when printing non-BMP character

2019-04-24 Thread Martin Panter

Martin Panter  added the comment:

I haven’t looked at the code, but I suspect Idle implements a custom 
“sys.displayhook”:

>>> help(sys.displayhook)
Help on function displayhook in module idlelib.rpc:

displayhook(value)
Override standard display hook to use non-locale encoding

>>> sys.displayhook('\N{ROCKET}')
'\U0001f680'
>>> sys.__displayhook__('\N{ROCKET}')
Traceback (most recent call last):
  File "", line 1, in 
sys.__displayhook__('\N{ROCKET}')
  File "/usr/lib/python3.5/idlelib/PyShell.py", line 1344, in write
return self.shell.write(s, self.tags)
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 1-1: 
Non-BMP character not supported in Tk

--
nosy: +martin.panter

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



[issue36711] duplicate method definition in Lib/email/feedparser.py

2019-04-24 Thread Martin Panter

Martin Panter  added the comment:

This is caused by Serhiy’s first change to 2.7 in Issue 21448. Compare 
Mercurial rev. 1b1f92e39462 (3.4 branch) with ba90bd01c5f1 (2.7). In 2.7, he 
applied the Python 3 version of the code, which used “str.splitlines” rather 
than a regular expression “NLCRE_crack.split”. This seems reasonable, but the 
old Python 2 code remains under a spurious “def pushlines” block.

I think that first block of “pushlines” can safely be removed, just leaving the 
second version, a single line of code like in Python 3.

--
components: +email -Library (Lib)
nosy: +barry, martin.panter, r.david.murray

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



[issue36701] module 'urllib' has no attribute 'request'

2019-04-23 Thread Martin Panter

Martin Panter  added the comment:

The “urllib” package also contains “urllib.parse”, which is a lot more 
lightweight than “urllib.request”. In a quick experiment, importing 
“urllib.request” is more than 2 times slower than importing “urllib.parse” on 
its own. And importing “urllib” by itself is not much faster, so I guess a lot 
of the time is unavoidable Python startup, and “urllib.request” is probably 
many times slower than “urllib.parse”.

The reason for the slowness is the dependencies and initialization. The 
“urllib.parse” module only imports a few commonly-used modules. On the other 
hand, importing “urllib.request” imports many heavyweight high-level modules 
directly and indirectly (email submodules in particular, also things like SSL, 
multithreading, HTTP client, temporary files). Some of these dependencies also 
compile lots of regular expressions at import time.

The slowdown can be a problem for things like command-line programs. Just today 
I found “circusd --help” on a Raspberry Pi took ~5 s to produce output.

The case of “os.path” is different: it isn’t a submodule of “os”. It is just a 
pointer to “posixpath”, “ntpath”, etc, depending on “os.name”.

--
nosy: +martin.panter

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



[issue33632] undefined behaviour: signed integer overflow in threadmodule.c

2019-04-14 Thread Martin Panter

Martin Panter  added the comment:

Victor, if you run the test suite, one of the test cases should trigger the 
overflow. I used to compile with Undefined Behaviour Sanitizer to print 
messages when these errors occur; see 
<https://bugs.python.org/issue1621#msg271118> for my setup at the time. I 
presume Antoine did something similar.

I do not remember, but suspect the test case might be the following lines of 
“BaseLockTests.test_timeout” in Lib/test/lock_tests.py, testing a fraction of a 
second less than PY_TIMEOUT_MAX:

# TIMEOUT_MAX is ok
lock.acquire(timeout=TIMEOUT_MAX)

Perhaps reducing PY_TIMEOUT_MAX by a few centuries would be one way to avoid 
the problem. In my patch I avoided the problem by rearranging the arithmetic, 
so that the timeout value is only compared and reduced, never added.

--

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



[issue17267] datetime.time support for '+' and '-'

2019-04-13 Thread Martin Panter

Martin Panter  added the comment:

A real use case that I have had was with a protocol to activate a device with a 
daily schedule. The protocol takes start and end hours and minutes of the day. 
To test the device by activating it over the next few minutes, my ideal way 
would have taken the current time (according to the device controller) as a 
“time” object, and added a couple of minutes using “timedelta”. In the end I 
think I made my protocol API accept both “time” and “timedelta" objects, 
because I found “timedelta” more flexible for calculations, but the “time” 
class more natural in other cases.

The start and end times are local times, and daylight saving could come into 
play, but in reality I won’t be testing the device at 3 a.m. on a Sunday 
morning. If I did care, I would have to add my own logic with knowledge of the 
date and daylight saving, to raise an exception.

I agree with Alexander about supporting the difference between two “time” 
instances. The result should be a non-negative “timedelta”, at least zero, and 
strictly less than 24 h.

--
nosy: +martin.panter

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



[issue36600] re-enable test in nntplib

2019-04-12 Thread Martin Panter

Martin Panter  added the comment:

Does the test still depend on real-world posts? If so, see Issue 19613. I don’t 
think the problem has been fixed.

--
nosy: +martin.panter
superseder:  -> test_nntplib: sporadic failures, test_article_head_body()

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



[issue30458] [security][CVE-2019-9740][CVE-2019-9947] HTTP Header Injection (follow-up of CVE-2016-5699)

2019-04-10 Thread Martin Panter

Martin Panter  added the comment:

Gregory, I haven’t tried recent Python code, but I expect the problem with 
percent decoding is still there. If you did try my example, what results did 
you see? Be aware that these techniques only work if the OS co-operates and 
connects to localhost when you give it the longer host string. At the moment I 
have glibc 2.26 on x86-64 Linux.

In the Python 3 master branch, the percent-encoding should be decoded in 
“urllib.request.Request._parse”:

def _parse(self):
...
self.host, self.selector = _splithost(rest)
if self.host:
self.host = unquote(self.host)

Then in “AbstractHTTPHandler.do_request_” the decoded host string becomes the 
“Host” header field value, without any encoding:

def do_request_(self, request):
host = request.host
...
sel_host = host
...
if not request.has_header('Host'):
request.add_unredirected_header('Host', sel_host)

Perhaps one solution to both my version and Orange’s original version is to 
encode the “Host” header field value properly. This might also apply to the 
“http.client” code.

--

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



[issue36293] Nonblocking read sys.stdin raises error

2019-03-30 Thread Martin Panter


Change by Martin Panter :


--
resolution:  -> duplicate

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



[issue36293] Nonblocking read sys.stdin raises error

2019-03-30 Thread Martin Panter

Martin Panter  added the comment:

I wasn’t sure about closing it, in case Cyker came back with more details. E.g. 
what was the use case? Were they mislead by the documentation? Do they just 
think the error should be different, or do they think there should be no error 
in this case?

But I suppose we can close this and keep discussion about non-blocking text 
input together in the existing reports.

--
stage:  -> resolved
status: open -> closed

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



[issue35403] support application/wasm in mimetypes and http.server

2019-03-30 Thread Martin Panter


Change by Martin Panter :


--
superseder:  -> http.server module sets incorrect mimetype for WebAssembly files

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



[issue35403] support application/wasm in mimetypes and http.server

2019-03-30 Thread Martin Panter

Martin Panter  added the comment:

According to Issue 34758, this was already added to 3.8’s “mimetypes”.

--
nosy: +martin.panter
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

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



[issue36483] Missing line in documentation example

2019-03-30 Thread Martin Panter

Martin Panter  added the comment:

Did you read the bracketed paragraph directly below, or try running the code 
with your “break” statement? I expect it would stop at the first prime number 
(two). But the output continues with more prime numbers.

--
nosy: +martin.panter
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue36464] Python 2.7 build install fails intermittently with -j on MacOS

2019-03-30 Thread Martin Panter

Martin Panter  added the comment:

On Linux, Gnu’s “install” command is happy if the target directory already 
exists; it just changes the mode (-m) etc. So the race isn’t a big deal.

This is like the race I described (theoretical at the time) at 
<https://bugs.python.org/issue25696#msg255393>, although that is about $(LIBPC) 
not $(LIBDIR). I suggested adding a separate target (a bit like Paul’s 
“make-directories” suggestion; see my -4.patch in that bug), but it didn’t get 
much support.

A more conservative patch would be a phony target that retains the existing “if 
/ echo / install” logic.

--
nosy: +martin.panter
stage:  -> needs patch

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



[issue33319] `subprocess.run` documentation doesn't tell is using `stdout=PIPE` safe

2019-03-22 Thread Martin Panter

Martin Panter  added the comment:

This is a regression in the 3.7+ documentation. It previously said “To [capture 
output], pass PIPE for the ‘stdout’ and/or ‘stderr’ arguments”. This was 
removed by Bo Bayles in Issue 32102.

--
keywords: +3.7regression
nosy: +bbayles, gregory.p.smith, martin.panter
stage:  -> needs patch
versions: +Python 3.7, Python 3.8, Python 3.9

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



[issue36304] When using bz2 and lzma in mode 'wt', the BOM is not written

2019-03-15 Thread Martin Panter

Martin Panter  added the comment:

I suspect this is caused by TextIOWrapper guessing if it is writing the start 
of a file versus in the middle, and being confused by “seekable” returning 
False. GzipFile implements some “seek” calls in write mode, but LZMAFile and 
BZ2File do not.

Using this test class:

class Writer(BufferedIOBase):
def writable(self):
return True
def __init__(self, offset):
self.offset = offset
def seekable(self):
result = self.offset is not None
print('seekable ->', result)
return result
def tell(self):
print('tell ->', self.offset)
return self.offset
def write(self, data):
print('write', repr(data))

a BOM is inserted when “tell” returns zero:

>>> t = io.TextIOWrapper(Writer(0), 'utf-16')
seekable -> True
tell -> 0
>>> t.write('HI'); t.flush()  # Writes BOM
2
write b'\xff\xfeH\x00I\x00'

and not when “tell” returns a positive number:

>>> t = io.TextIOWrapper(Writer(1), 'utf-16')
seekable -> True
tell -> 1
>>> t.write('HI'); t.flush()  # Omits BOM
2
write b'H\x00I\x00'

However the “io” and “_pyio” behaviours differ when “seekable” returns False:

>>> t = io.TextIOWrapper(Writer(None), 'utf-16')
seekable -> False
>>> t.write('HI'); t.flush()  # io omits BOM
2
write b'H\x00I\x00'
>>> t = _pyio.TextIOWrapper(Writer(None), 'utf-16')
seekable -> False
>>> t.write('HI'); t.flush()  # _pyio writes BOM
write b'\xff\xfeH\x00I\x00'
2

IMO the “_pyio” behaviour is more sensible: write a BOM because that’s what the 
UTF-16 codec produces.

--
nosy: +martin.panter

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



[issue36294] `io.BufferedIOBase` returns `None`

2019-03-15 Thread Martin Panter

Martin Panter  added the comment:

The general problem of non-blocking reads with BufferedIOBase is covered by 
Issue 13322. The documentation and implementations do not agree. I suggest to 
not rely on any particular behaviour reading BufferedIOBase objects in 
non-blocking mode.

The problem of the concrete class BufferedReader (what “stdin.buffer” usually 
is) was also recently raised in Issue 35869.

--
nosy: +martin.panter
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> buffered read() and write() does not raise BlockingIOError

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



[issue36293] Nonblocking read sys.stdin raises error

2019-03-15 Thread Martin Panter

Martin Panter  added the comment:

This is the same story as in Issue 35762. Both “sys.stdin” and 
“subprocess.Popen.stderr” (when universal_newlines=True is enabled) use the 
TextIOWrapper class, which I don’t think was implemented with non-blocking mode 
in mind.

Issue 24560 is similar, but is about an older class “codecs.StreamReader”.

--
nosy: +martin.panter
superseder:  -> subprocess.Popen with universal_newlines and nonblocking 
streams fails with "can't concat NoneType to bytes"

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



[issue25476] close() behavior on non-blocking BufferedIO objects with sockets

2019-03-15 Thread Martin Panter


Change by Martin Panter :


--
stage:  -> resolved
status: pending -> closed

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



[issue36246] csv.writer lineterminator affects csv escaping

2019-03-08 Thread Martin Panter

Martin Panter  added the comment:

This is the result that I see:

>>> output = StringIO()
>>> csv.writer(output, lineterminator='\n').writerow(["Whoa!\rNewlines!"])
16
>>> output.getvalue()
'Whoa!\rNewlines!\n'

For comparison, this is the result with CRLF terminators (the default):

>>> output = StringIO()
>>> csv.writer(output, lineterminator='\r\n').writerow(["Whoa!\rNewlines!"])
19
>>> output.getvalue()
'"Whoa!\rNewlines!"\r\n'

Is it a problem that the line terminator determines whether the CR is quoted or 
not? I believe the default policy is “excel”, which happens to use 
QUOTE_MINIMAL. This behaviour is documented: 
<https://docs.python.org/3.7/library/csv.html#csv.QUOTE_MINIMAL>.

--
nosy: +martin.panter
resolution:  -> not a bug
status: open -> pending

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



[issue36226] multipart/related header causes false positive StartBoundaryNotFoundDefect and MultipartInvariantViolationDefect

2019-03-07 Thread Martin Panter


Martin Panter  added the comment:

Probably the same as Issue 29353. I remember than enabling "headersonly" can 
create inconsistencies in the message object. But I don't remember the details.

According to Issue 29991 (another duplicate), my patch for Issue 24363 might 
help. But I don't think I got much enthusiasm reviewing that (and I don't have 
time to spend on it now).

--
nosy: +martin.panter

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



[issue36172] csv module internal consistency

2019-03-03 Thread Martin Panter

Martin Panter  added the comment:

The documentation 
<https://docs.python.org/dev/library/csv.html#module-contents> says you should 
“open the files with newline=''.” IMO this is an unfortunate quirk of the CSV 
module. Everything else that I know of in the Python built-in library either 
works with binary files, which typically do no newline translation in Python 3, 
or is fine with newline translation enabled in text mode. See also Issue 10954 
about making the behaviour stricter.

--
nosy: +martin.panter

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



[issue36161] Use thread-safe functions instead of unsafe ones (crypt, ttyname)

2019-03-01 Thread Martin Panter

Martin Panter  added the comment:

In Issue 28503, “crypt_r” was added to Python 3.7 and 3.8+, and it looks like 
it is still there.

Regarding error handling for “crypt”, it is not documented, but the Python 
function returns None on error. You would have to consider backwards 
compatibility to use OSError. Perhaps add a new parameter like 
“crypt(raise_error=True)”?

--
nosy: +martin.panter

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



[issue36050] Why does http.client.HTTPResponse._safe_read use MAXAMOUNT

2019-02-24 Thread Martin Panter


Martin Panter  added the comment:

The 1 MiB limit was added for Issue 1296004; apparently some platforms were 
overallocating multiple buffers and running out of memory. I suspect the loop 
in "_safe_read" was inherited from Python 2, which has different kinds of file 
objects. The comments suggest it does partial reads.

But the Python 3 code calls "socket.makefile" with "buffering" mode enabled by 
default. I agree it should be safe to read the total length in one go.

--
nosy: +martin.panter

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



[issue36064] docs: urllib.request.Request not accepting iterables data type

2019-02-22 Thread Martin Panter

Martin Panter  added the comment:

I agree the documentation is insufficient. It should have said if “data” is 
iterated, it must yield bytes-like objects.

I agree it is unwise to yet more special cases for the uploaded data types. 
When Lye passed the dictionary of three keys and values, I suspect they weren’t 
expecting it to upload just the key names using one HTTP chunk for each key. 
See Issue 23740 about the mess of data types currently supported.

--

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



[issue31162] urllib.request.urlopen CERTIFICATE_VERIFY_FAILED error

2019-02-22 Thread Martin Panter


Change by Martin Panter :


--
resolution:  -> not a bug
status: open -> pending
title: urllib.request.urlopen error -> urllib.request.urlopen 
CERTIFICATE_VERIFY_FAILED error

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



[issue22865] Document how to make pty.spawn not copy data

2019-02-21 Thread Martin Panter


Martin Panter  added the comment:

I'm not sure it is wise for the Python documentation to suggest inserting null 
bytes in general. This seems more like an application-specific hack. There is 
nothing in Python that handles these null bytes specially, and I expect they 
will be seen if the child reads the terminal in raw mode, or if the parent's 
output is redirected to a file, sent over the network or a real serial link.

--

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



[issue34785] pty.spawn -- auto-termination after child process is dead (a zombie)

2019-02-21 Thread Martin Panter


Martin Panter  added the comment:

Suggest closing this assuming it is a duplicate, unless Jarry can give more 
information.

--
resolution:  -> duplicate
status: open -> pending
superseder:  -> pty.spawn hangs on FreeBSD 9.3, 10.x

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



[issue5038] urrlib2/httplib doesn't reset file position between requests

2019-02-15 Thread Martin Panter

Martin Panter  added the comment:

For 3.7+ (where iterable objects are supported), I suggest:

1. Document the problem as a limitation of handlers like 
AbstractBasicAuthHandler, and consider raising an exception instead of trying 
to upload a file or iterable a second time.

2. Clarify the behaviour for different types of the “urllib.request” data 
parameter. I understand “file-like objects” means objects with a “read” 
attribute, and the “read” method is called in preference to iteration or 
treating the parameter as a “bytes” object.

Despite the bug title, I don’t think the library should mess with the file 
position. Certainly not when making a single request. But it should already be 
possible for the caller to supply a custom iterable object that resets the file 
position:

class FileReiterator:
def __iter__(self):
self.file.seek(0)
while True:
chunk = self.file.read(self.chunksize)
yield chunk
if len(chunk) < self.chunksize:
break

--

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



[issue22347] mimetypes.guess_type("//example.com") misinterprets host name as file name

2019-02-08 Thread Martin Panter


Change by Martin Panter :


--
dependencies: +Remove urllib.parse._splittype from mimetypes.guess_type

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



[issue25862] TextIOWrapper assertion failure after read() and SEEK_CUR

2019-02-08 Thread Martin Panter

Martin Panter  added the comment:

I haven’t confirmed, but it looks like the original change here broke 
bidirectional reading and writing with a single TextIOWrapper object; see Issue 
35928.

--

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



[issue35928] socket makefile read-write discards received data

2019-02-08 Thread Martin Panter


Martin Panter  added the comment:

Looking over the changelog, my guess (untested) is this is caused by commit 
d6a283b3 for Issue 25862. That change looks like it drops the internal 
TextIOWrapper decoding buffer for each successful write.

I don't have the right version of Python to test with, but I expect this to 
also be broken without using a socket:

>>> f = TextIOWrapper(BufferedRWPair(BytesIO(b"Hello\nYou\n"), BytesIO()))
>>> f.readline()
'Hello\n'
>>> f.write(_)
6
>>> f.readline()  # Does this now return EOF?
'You\n'

--
keywords: +3.6regression
nosy: +martin.panter

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



[issue35906] Header Injection in urllib

2019-02-06 Thread Martin Panter


Martin Panter  added the comment:

Maybe related to Victor's "Issue 1" described in Issue 32085. That is also a 
security bug about CRLF in the URL's path, but was opened before Issue 30500 
was opened and the code changed, so I'm not sure if it is the same as this or 
not.

Also there is Issue 13359, a proposal to automatically percent-encode invalid 
URLs. For a security fix, I'm not sure but it might be safer to raise an 
exception, rather than rewriting the invalid URL to a valid one.

--

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



[issue35869] io.BufferReader.read() returns None

2019-02-01 Thread Martin Panter

Martin Panter  added the comment:

This is covered by Issue 13322. There are a few other BufferedReader methods 
that contradict the documentation for non-blocking mode.

A while ago I posted a patch to change the implementation to match the 
documentation, but nobody reviewed it or gave their opinion. These days I would 
prefer to just documentat the reality: the methods might raise an exception 
rather than returning None, or perhaps no particular behaviour at all is 
expected in general in the non-blocking case. But I don’t spend much time on 
Python now, so you might have to find someone else to move this forward.

Regarding the entry for “BufferedReader.read”, it would make more sense to 
remove the last “if”: “if ‘size’ is not given . . ., until EOF, or the ‘read’ 
call would block”. But I don’t think even that is complete, because it should 
also say the read stops and returns short in the non-blocking case even when 
“size” is positive.

--
assignee:  -> docs@python
components: +Documentation, IO
nosy: +docs@python, martin.panter
superseder:  -> buffered read() and write() does not raise BlockingIOError

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



[issue35870] readline() specification is unclear

2019-01-31 Thread Martin Panter


Martin Panter  added the comment:

I agree that the documentation should be clearer about the first two points. 
Considering that the "input" function and by default the "str.splitlines" 
method both behave differently, I often had to re-learn this when I had less 
Python experience.

The expected behaviour as I understand is the line terminator is included if it 
was read. It is not included if the size limit or EOF was reached first. The 
Python 2 documentation 
<https://docs.python.org/2/library/stdtypes.html#file.readline> is clear about 
both the newline being included and EOF behaviour.

Regarding text files, if you mean the "TextIOWrapper.readline" method, I think 
it is reasonable to assume you get the translated line endings as specified by 
the constructor's "newline" argument: 
<https://docs.python.org/3/library/io.html#io.TextIOWrapper>. Newline='' and 
newline='\r\n' would keep the '\r\n' terminators, and newline=None would 
translate them to '\n'.

--
nosy: +martin.panter

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



[issue35848] readinto is not a method on io.TextIOBase

2019-01-30 Thread Martin Panter

Martin Panter  added the comment:

I think it would be more practical to fix the documentation (option 1). Do you 
have a use case for “TextIOBase.readinto” raising ValueError (something more 
concrete than someone having expectations)?

--
nosy: +martin.panter

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



[issue31456] SimpleCookie fails to parse any cookie if an entry has whitespace in the name

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

The main cause of this behaviour is that whitespace (matching the ASCII RE 
“\s”) is treated as separation between cookie “morsels”. It looks like this has 
always been the behaviour, but I’m not sure it was intended.

>>> print(BaseCookie('first=morsel second=morsel'))
Set-Cookie: first=morsel
Set-Cookie: second=morsel

This could be a security problem, if an attacker managed to inject a CSRF token 
as the second “morsel”. This was mentioned in 
<https://translate.google.com/translate?u=https://habr.com/en/post/272187/>.

IMO it would be better to not split off a second morsel. Either keep it as one 
long morsel value with spaces in, or skip over it to the next semicolon (;).

The reason why the whole cookie string is lost is due to the behaviour of 
cookie morsels without equals signs:

>>> BaseCookie('cookie=lost; ignore').items()
dict_items([])

IMO it would be better to skip over these to the next semicolon as well. It 
looks like this is a regression in Python 3.5+ caused by Issue 22796.

--
nosy: +martin.panter

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



[issue2212] Cookie.BaseCookie has ambiguous unicode handling

2019-01-26 Thread Martin Panter


Change by Martin Panter :


--
stage: test needed -> resolved
status: open -> closed

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



[issue2212] Cookie.BaseCookie has ambiguous unicode handling

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

Same as Issue 11315, where Éric suggested documenting the behaviour.

--
nosy: +martin.panter
resolution:  -> duplicate
superseder:  -> unicode support in Cookie module

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



[issue11315] unicode support in Cookie module

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

Sorry, but changing to bytes after ten years of using str in this module in 
Python 3 is not going to happen. Let’s just document the state of Python 2 (see 
Éric: https://bugs.python.org/issue11315#msg129448).

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, ezio.melotti, martin.panter, vstinner
title: Fix type regression in http.cookies.load (want bytes, not str) -> 
unicode support in Cookie module
versions: +Python 2.7 -Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 
3.6

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



[issue19670] SimpleCookie Generates Non-RFC6265-Compliant Cookies

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

I think the solution here is to document what “SimpleCookie.value_encode” 
really does: RFC 2109 quoted-string escaping. If you want to a generate 
RFC-6265-compliant Set-Cookie string, do not include non-compliant characters 
in the cookie value, and consider using BaseCookie rather than SimpleCookie, 
especially if your “morsel” values are enclosed in double quotes.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, martin.panter

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



[issue35833] Backspace not working

2019-01-26 Thread Martin Panter


Martin Panter  added the comment:

Ment to point to previous bug report: Issue 23220

--

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



[issue35833] Backspace not working

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

I suspect Idle just passes control characters directly to an underlying Text or 
similar TK widget. As far as I know, TK only documents behaviour for tabs and 
newlines, not other control characters.

Last time this was brought up, Terry added a sentence under 
<https://docs.python.org/3.7/library/idle.html#user-output-in-shell>, third 
paragraph, about this:

“Newline characters cause following text to appear on a new line, but other 
control characters are either replaced with a box or deleted.”

--
nosy: +martin.panter

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



[issue35824] http.cookies._CookiePattern modifying regular expressions

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

I presume MeiK wants to use BaseCookie to parse the Set-Cookie header field, as 
in

>>> BaseCookie('Hello=World; Expires=Thu, 31 Jan 2019 05:56:00 GMT;')

>>> BaseCookie('Hello=World; Expires=Thu,31 Jan 2019 05:56:00 GMT;')


Karthikeyan, if you meant the “sane-cookie-date” format 
(https://tools.ietf.org/html/rfc6265#page-9), that is just the IETF’s 
recommended date format. I suspect MeiK is trying to _parse_ the date rather 
than generate it, in which case the procedure in 
<https://tools.ietf.org/html/rfc6265#section-5.1.1> may be more relevant. 
Spaces and commas are both treated as delimiters, so the problematic Expires 
attribute should parse fine.

BTW, this special handling of Set-Cookie attributes like Expires is not 
documented, though it does seem intentional. According to the documentation 
they should be treated as new Morsels.

--
nosy: +martin.panter

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



[issue23930] http.cookies.SimpleCookie doesn't parse comma-only separated cookies correctly

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

I think making a comma start a new cookie is dangerous, and perhaps this 
proposal should be rejected.

I’m not an expert on web programming, but this reminds me of some security 
problems that already affected Python: 
<https://translate.google.com/translate?u=https://habr.com/en/post/272187/>. In 
a web page, Java Script could set a cookie with a single name and a comma in 
the value.

document.cookie = 'a=b,csrftoken=INJECTED'

Currently, Python in the server would parse that the way the script intended:

>>> C = BaseCookie('a=b,csrftoken=INJECTED')
>>> C['a'].value
'b,csrftoken=INJECTED'
>>> C['csrftoken'].value
KeyError: 'csrftoken'

But with the proposed change, Python would be tricked into parsing it as two 
separate “morsels”:

>>> C['csrftoken'].value
'INJECTED'

--
nosy: +martin.panter
type: behavior -> enhancement

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



[issue35762] subprocess.Popen with universal_newlines and nonblocking streams fails with "can't concat NoneType to bytes"

2019-01-18 Thread Martin Panter

Martin Panter  added the comment:

Yes, universal newlines mode uses the TextIOWrapper class to read the pipe, 
which isn’t really designed for non-blocking mode. This is the same problem 
described by Izbyshev at <https://bugs.python.org/issue13322#msg307763>.

Raising TypeError isn’t ideal. IMO it would be better to raise BlockingIOError, 
which is what basic calls like “os.read” would do, and what 
“BufferedReader.read” is supposed to do according to the documentation. 
(However the documentation and implementation don’t match; that is what Issue 
13322 is about.)

--
nosy: +martin.panter
type: crash -> behavior

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



[issue13322] buffered read() and write() does not raise BlockingIOError

2019-01-18 Thread Martin Panter

Martin Panter  added the comment:

Issue 35762 was opened specifically about Izbyshev’s case: TextIOWrapper 
behaviour with a non-blocking file. Calling “os.fdopen” with mode='r' (text 
mode) returns a TextIOWrapper object.

--

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



[issue35748] urlparse library detecting wrong hostname leads to open redirect vulnerability

2019-01-18 Thread Martin Panter

Martin Panter  added the comment:

The “urllib.parse” module generally follows RFC 3986, which does not allow a 
literal backslash in the “userinfo” part:

userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
pct-encoded = "%" HEXDIG HEXDIG
sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="

The RFC does not allow a backslash in the host name, path, query or fragment 
either. That is why I said the URL is not valid.

--

___
Python tracker 
<https://bugs.python.org/issue35748>
___
___
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 (?)

2019-01-18 Thread Martin Panter

Martin Panter  added the comment:

Today I read RFC 3986, and I think the URLs in the bug reports are valid, and 
are already parsed correctly. The path is allowed to have a literal “at” symbol:

path-abempty = *( "/" segment )
segment = *pchar
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"

The query and fragment are allowed to have “at” and question marks:

query = *( pchar / "/" / "?" )
fragment = *( pchar / "/" / "?" )

So I think this could be closed because the parsing is working correctly.

--
resolution:  -> not a bug
status: open -> pending

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



[issue35748] urlparse library detecting wrong hostname leads to open redirect vulnerability

2019-01-16 Thread Martin Panter

Martin Panter  added the comment:

FWIW I understand the backslash should be percent-encoded in URLs, otherwise 
the URL is not valid.

This reminds me of a few other bugs:

* Issue 30500: Made the behaviour of fragment (#. . .) versus userinfo (. . .@) 
consistent, e.g. in //www.google.com#@xxx.com
* Issue 18140: Also about the ambiguity of fragment (#. . .) and query (?. . .) 
versus userinfo (. . .@)
* Issue 23328: Precedence of path segment (/. . .) versus userinfo (. . .@); 
e.g. //user/name:pass/w...@www.google.com

I think people some times come up with these invalid URLs because they are 
trying to make a URL that includes a password with unusual characters (e.g. for 
the “http_proxy” environment variable). So raising an exception or otherwise 
changing the parsing behaviour could break those cases.

--

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



[issue35483] tarfile.extractall on existing symlink in Ubuntu overwrites target file, not symlink, unlinke GNU tar

2019-01-06 Thread Martin Panter


Change by Martin Panter :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

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



[issue19974] tarfile doesn't overwrite symlink by directory

2019-01-06 Thread Martin Panter

Martin Panter  added the comment:

About “lexists”, I meant using it instead of “os.path.exits” (not “islink”). On 
Linux:

>>> targetpath = 'target'
>>> os.symlink('nonexistant', dst=targetpath)  # Make a broken symlink
>>> os.system('ls -l')
total 0
lrwxrwxrwx 1 vadmium vadmium 11 Jan  6 09:28 target -> nonexistant
0
>>> os.path.exists(targetpath)  # Doesn't register broken symlinks
False
>>> os.path.lexists(targetpath)  # Does register it
True

Did you try extracting a tar file over a broken link? (I haven’t tried your 
code; I’m just going on theory.)

--

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



[issue35649] http.client doesn't close. Infinite loop

2019-01-03 Thread Martin Panter

Martin Panter  added the comment:

This was changed in Python 3.2+ in Issue 16723. The response object no longer 
sets the “closed” attribute when it runs out of data; it is only set when the 
“close” method is called. Perhaps the example should be amended so that it 
checks if “read” returned an empty string, rather than checking “closed”.

Another problem with the example is that printing the chunk as a bytes object 
can trigger BytesWarning. I would add a “repr” call to avoid that.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, martin.panter

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



[issue35617] unittest discover does not work with implicit namespaces

2018-12-30 Thread Martin Panter

Martin Panter  added the comment:

Is this related to Issue 23882? That one is about making discovery work when 
“__init__.py” files are removed.

--
nosy: +martin.panter

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



[issue32419] Add unittest support for pyc projects

2018-12-30 Thread Martin Panter

Martin Panter  added the comment:

Seems to be a lot of overlap with Issue 26859 by Xavier. Looks like Xavier 
included a test case, but Bassemʼs changes on Git Hub seem more thorough in the 
impementation and doc strings.

--
nosy: +martin.panter

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



[issue35611] open doesn't call IncrementalEncoder with final=True

2018-12-29 Thread Martin Panter

Martin Panter  added the comment:

FWIW this happens with the built-in IDNA codec, and Amaury gave a demonstration 
under <https://bugs.python.org/issue17404#msg184045>.

I don’t think the “TextIOWrapper.flush” method should use final=True, but 
“close” and “detach” probably should.

--
nosy: +martin.panter

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



[issue17404] ValueError: can't have unbuffered text I/O for io.open(1, 'wt', 0)

2018-12-29 Thread Martin Panter

Martin Panter  added the comment:

It is documented that buffering=0 is not supported in text mode. Look a handful 
of paragraphs down from 
<https://docs.python.org/release/3.7.2/library/functions.html#open>:

“Pass 0 to switch buffering off (only allowed in binary mode)”

Amaury’s problem with the IDNA buffering encoder has now been reported 
separately in Issue 35611.

--
nosy: +martin.panter

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



[issue33661] urllib may leak sensitive HTTP headers to a third-party web site

2018-12-26 Thread Martin Panter

Martin Panter  added the comment:

Are you aware of the “add_unredirected_header” method? Maybe that is enough to 
avoid your problem.
https://docs.python.org/dev/library/urllib.request.html#urllib.request.Request.add_unredirected_header

--
nosy: +martin.panter
title: urllib may leak sensitive HTTP headers to a third-party web site -> 
urllib may leak sensitive HTTP headers to a third-party web site

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



  1   2   3   4   5   6   7   8   9   10   >