[issue32206] Run modules with pdb

2018-01-05 Thread Nick Coghlan

Nick Coghlan  added the comment:

Thanks for the patch!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



[issue32206] Run modules with pdb

2018-01-05 Thread Nick Coghlan

Nick Coghlan  added the comment:


New changeset 9f1e5f1b7f074e026843a5d70834233a95a6bf9d by Nick Coghlan (Mario 
Corchero) in branch 'master':
bpo-32206: Pdb can now run modules (GH-4752)
https://github.com/python/cpython/commit/9f1e5f1b7f074e026843a5d70834233a95a6bf9d


--

___
Python tracker 

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



[issue29137] Fix fpectl-induced ABI breakage

2018-01-05 Thread Benjamin Peterson

Change by Benjamin Peterson :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue32443] Add Linux's signalfd() to the signal module

2018-01-05 Thread Nathaniel Smith

Change by Nathaniel Smith :


--
nosy: +njs

___
Python tracker 

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



[issue29137] Fix fpectl-induced ABI breakage

2018-01-05 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 735ae8d139a673b30b321dc10acfd3d14f0d633b by Benjamin Peterson 
(Nathaniel J. Smith) in branch 'master':
bpo-29137: Remove fpectl module (#4789)
https://github.com/python/cpython/commit/735ae8d139a673b30b321dc10acfd3d14f0d633b


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue32441] os.dup2 should return the new fd

2018-01-05 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I would just make a declaration a definition with a dummy value (0?) rather 
than complicating the branches.

--

___
Python tracker 

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



[issue32450] non-descriptive variable name

2018-01-05 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I would accept a PR to rename the variable in ast.c to "level", but I'm not 
sure why it should matter to you.

--

___
Python tracker 

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



[issue32486] tail optimization for 'yield from'

2018-01-05 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

The original yield from implementation did something like this, but we dropped 
it because it caused debuggability problems. See #14230

--
nosy: +benjamin.peterson
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue8243] curses writing to window's bottom right position raises: `_curses.error: addstr() returned ERR'

2018-01-05 Thread Jay Crotts

Jay Crotts  added the comment:

I can create a documentation patch and PR if this still needs doing.

--
nosy: +jcrotts

___
Python tracker 

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



[issue20104] expose posix_spawn(p)

2018-01-05 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


--
pull_requests: +4976

___
Python tracker 

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



[issue20104] expose posix_spawn(p)

2018-01-05 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


--
pull_requests: +4976, 4977

___
Python tracker 

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



[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-05 Thread Michał Górny

New submission from Michał Górny :

While debugging PyPy test failure on backports.lzma [1], I've noticed that 
PySequence_Check() on a dict type raises TypeError, e.g.:

  Traceback (most recent call last):
File "test/test_lzma.py", line 273, in test_bad_args
  b"", format=lzma.FORMAT_RAW, filters={})
File 
"/home/mgorny/git/backports.lzma/build/lib.linux-x86_64-3.6/backports/lzma/__init__.py",
 line 463, in decompress
  decomp = LZMADecompressor(format, memlimit, filters)
  TypeError: object of type 'dict' has no len()

The relevant C code is:

  static int
  parse_filter_chain_spec(lzma_filter filters[], PyObject *filterspecs)
  {
Py_ssize_t i, num_filters;

num_filters = PySequence_Length(filterspecs);
...

where filterspecs is the object corresponding to the {} dict in Python snippet.

According to the documentation [2], PySequence_Length() should be 'equivalent 
to the Python expression len(o).' The Python expression obviously does not 
raise TypeError:

  >>> len({})
  0

Therefore, I think that the behavior of PySequence_Length() is a bug, and the 
function should successfully return the dict length instead.

[1]:https://github.com/peterjc/backports.lzma
[2]:https://docs.python.org/3/c-api/sequence.html#c.PySequence_Length

--
components: Extension Modules
messages: 309534
nosy: mgorny
priority: normal
severity: normal
status: open
title: PySequence_Length() raises TypeError on dict type
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue30579] Allow traceback objects to be instantiated/mutated/annotated

2018-01-05 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Ping -- anyone up for reviewing PR 4793?

https://github.com/python/cpython/pull/4793

It's pretty straightforward, and I figure better to ping now and beat the 
end-of-month rush :-)

--

___
Python tracker 

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



[issue29137] Fix fpectl-induced ABI breakage

2018-01-05 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Ping -- anyone up for reviewing PR 4789?

https://github.com/python/cpython/pull/4789

It's pretty straightforward, and I figure better to ping now and beat the 
end-of-month rush :-). Also, it has an autoconf refresh in it, so it's likely 
to develop spurious conflicts at some point.

--

___
Python tracker 

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



[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2018-01-05 Thread Brett Cannon

Change by Brett Cannon :


--
pull_requests: +4975

___
Python tracker 

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



[issue30855] [2.7] test_tk: test_use() of test_tkinter.test_widgets randomly fails with "integer value too large to represent" on with AMD64 Windows8 3.5

2018-01-05 Thread STINNER Victor

STINNER Victor  added the comment:

Awesome, thanks!

--

___
Python tracker 

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



[issue25095] test_httpservers hangs since Python 3.5

2018-01-05 Thread Martin Panter

Martin Panter  added the comment:

Thanks, although the fact that “Content-Length: 0” doesn’t work kills my theory 
about the proxy.

The “close_connection” flag is also a documented public API of Python: 
.
 According to the rules for framing the message body in 
, the presence of 
“Connection: close” is not important. The server actually shutting down the 
connection is the key. That is why I prefer to explicitly set the flag (if it 
works).

Anyway, your current proposal makes the server send a valid full HTTP response.

--

___
Python tracker 

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



[issue32486] tail optimization for 'yield from'

2018-01-05 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I think this should have been first floated on python-ideas list.  One 
objection is the same as for eliminating tail calls in general: it collapses 
tracebacks.

def g1():
yield from g2()
def g2():
yield 1/0
for i in g1(): pass

Traceback (most recent call last):
  File "F:\Python\a\tem.py", line 7, in 
for i in g1(): pass
  File "F:\Python\a\tem.py", line 2, in g1
yield from g2()
  File "F:\Python\a\tem.py", line 5, in g2
yield 1/0
ZeroDivisionError: division by zero

There was at least some discussion of making 'yield from' internally more 
efficient without actual replacement.  I don't know what the current CPython 
implementation does.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue25095] test_httpservers hangs since Python 3.5

2018-01-05 Thread William Pickard

William Pickard  added the comment:

I have tried value 0 for "Content-Length" (along with "text/plain" for 
"Content-Type"), it was when I said I tried both "Content-Length" and 
"Content-Type", while I haven't tried directly setting "close_connection" in 
the handler, my solution is based on how "send_error()" works internally, not 
only that, but send_header is public API (by convention) and the "Connection" 
header is part of HTTP 1.1 so it should be documented ( reference: 
https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html ), so I don't really 
understand why my initial solution is consider "undocumented logic"

--

___
Python tracker 

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



[issue30855] [2.7] test_tk: test_use() of test_tkinter.test_widgets randomly fails with "integer value too large to represent" on with AMD64 Windows8 3.5

2018-01-05 Thread Zachary Ware

Zachary Ware  added the comment:

I think so :)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue30855] [2.7] test_tk: test_use() of test_tkinter.test_widgets randomly fails with "integer value too large to represent" on with AMD64 Windows8 3.5

2018-01-05 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thank you Zachary! Can this issue be closed now?

--

___
Python tracker 

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



[issue30855] [2.7] test_tk: test_use() of test_tkinter.test_widgets randomly fails with "integer value too large to represent" on with AMD64 Windows8 3.5

2018-01-05 Thread Zachary Ware

Zachary Ware  added the comment:

I manually cleared `externals\tcltk64` on that bot some time ago, and it 
appears to be happy now.

--

___
Python tracker 

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



[issue32498] urllib.parse.unquote raises incorrect errormessage when string parameter is bytes

2018-01-05 Thread R. David Murray

R. David Murray  added the comment:

If you read the traceback the message is "correct" for some definition of 
correct: the right hand side controls the type of the expression, so it is 
objecting to trying to look for the string '%' in a bytes object.

There are probably ways this could be improved, but I'm not sure it is worth 
it, since this is just a general behavior of the 'in' operator.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue25095] test_httpservers hangs since Python 3.5

2018-01-05 Thread Martin Panter

Martin Panter  added the comment:

Sorry William, I forgot the client was waiting to read. But I don’t understand 
why your Connection field (which comes after the status line) allows the Python 
client to read the status line. Perhaps there is some malware scanner, 
firewall, or other proxy that intercepts the HTTP protocol? (I encountered 
something similar at work recently.)

You said “my suggestion will never work”, but did you try setting 
“close_connection” on its own:

def do_GET(self):
self.send_response(HTTPStatus.OK)
self.end_headers()
self.close_connection = True  # Terminate response body to proxy

You tried adding Content-Length, but did you try “Content-Length: 0”:

def do_GET(self):
self.send_response(HTTPStatus.OK)
self.send_header("Content-Length", "0")  # Stop proxy reading body
self.end_headers()

--

___
Python tracker 

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



[issue32499] Add dataclasses.is_dataclass(obj)

2018-01-05 Thread Eric V. Smith

New submission from Eric V. Smith :

See https://mail.python.org/pipermail/python-dev/2018-January/151628.html and 
prior for the discussion.

Add dataclasses.is_dataclass(obj) that returns True if obj is a dataclass class 
or instance, else returns False.

--
assignee: eric.smith
components: Library (Lib)
messages: 309523
nosy: eric.smith
priority: normal
severity: normal
status: open
title: Add dataclasses.is_dataclass(obj)
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue32458] test_asyncio failures on Windows

2018-01-05 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

After fresh update and debug rebuild on master(3.7), with Win10 patched last 
night, I got
==
FAIL: test_call_later (test.test_asyncio.test_events.ProactorEventLoopTests)
--
Traceback (most recent call last):
  File "F:\dev\3x\lib\test\test_asyncio\test_events.py", line 290, in 
test_call_later
self.assertTrue(0.08 <= t1-t0 <= 0.8, t1-t0)
AssertionError: False is not true : 0.078861473

I have not seen this before.  Four subsequent runs passed.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue32450] non-descriptive variable name

2018-01-05 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

'ndots' is an internal name in the import-from branch of the import statement 
handler.  It seems reasonable in that context.  'level' is part of the public 
api for the ImportFrom node class, and cannot be changed as such.  It is also 
the parameter that receives the ndot value in the ImportFrom call, to be 
assigned to the level attribute.  Making the name switch in the call is at 
least as reasonable as in the assignment.  I am not the expert here, but I 
would be inclined to rejected this as not worth the code churn.

--
nosy: +benjamin.peterson, brett.cannon, ncoghlan, terry.reedy, yselivanov

___
Python tracker 

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



[issue17607] missed peephole optimization (unnecessary jump at end of function after yield)

2018-01-05 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This optimization already is implemented in 3.5+. Actually it is implemented as 
a part of code generation, not a peepholer.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue32448] subscriptable

2018-01-05 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I agree that a better message would be nice.  But compiling 'a.b[c]' breaks the 
expression apart into the equivalent of 't=a.b; t[c]', where 't' is an 
anonymous reference, so as David notes, there is no 'name' left to display.  We 
don't have a 'not possible resoluton, so "won't fix (because not possible)" 
seems closest.

--
nosy: +terry.reedy
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue32498] urllib.parse.unquote raises incorrect errormessage when string parameter is bytes

2018-01-05 Thread stein-k

New submission from stein-k :

urllib.parse.unquote(b'abc%20def')
...
TypeError: a bytes-like object is required, not 'str'

--
components: Library (Lib)
messages: 309517
nosy: stein-k
priority: normal
severity: normal
status: open
title: urllib.parse.unquote raises incorrect errormessage when string parameter 
is bytes
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue25095] test_httpservers hangs since Python 3.5

2018-01-05 Thread William Pickard

William Pickard  added the comment:

It hangs for me on Windows 10 Professional running on a MSI gaming laptop for 
debug and PGO builds (Python 3.6)

--

___
Python tracker 

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



[issue25095] test_httpservers hangs since Python 3.5

2018-01-05 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Today, at least, python -m test -v  test_httpservers does not hang for me on 
any of 3.5, 3.6, or  3.7, installed or repository debug.  I don't know if the 
offending test was just disabled or somehow fixed.

--

___
Python tracker 

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



[issue32390] AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed

2018-01-05 Thread David Edelsohn

David Edelsohn  added the comment:

The AIX buildbots has been exhibiting testsuite failures, but not build 
(compile) failures. The buildbots do not visibly distinguish between the two 
cases in a strong manner.

We can disable / expect failure for the few, additional testcases on AIX so 
that the buildbots will report "success" to make new failures more obvious.

--

___
Python tracker 

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



[issue32495] Adding Timer to multiprocessing

2018-01-05 Thread Jay Crotts

Jay Crotts  added the comment:

I think your three reasons make sense, I've only found threading.Timer helpful 
in pretty trivial cases.

Do you think a more flexible or efficient Timer class would be useful?

--

___
Python tracker 

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



[issue30541] Add restricted mocks to the python unittest mocking framework

2018-01-05 Thread Paul Ganssle

Change by Paul Ganssle :


--
pull_requests: +4974

___
Python tracker 

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



[issue28416] defining persistent_id in _pickle.Pickler subclass causes reference cycle

2018-01-05 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 2.7

___
Python tracker 

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



[issue32497] datetime.strptime creates tz naive object from value containing a tzname

2018-01-05 Thread Paul Ganssle

Paul Ganssle  added the comment:

Sorry, forgot to include the link to the dateutil implementation of the 
fold-resolution code: https://github.com/dateutil/dateutil/pull/517/files

--

___
Python tracker 

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



[issue32497] datetime.strptime creates tz naive object from value containing a tzname

2018-01-05 Thread Paul Ganssle

Paul Ganssle  added the comment:

By the way, one possibly significant problem with this interface is that it 
would tend to encourage the use of static timezone offsets rather than rule 
sets as intended by `tzinfo`. The main problem is that a simple mapping between 
tzname and tzinfo (whether done with a Mapping or a callable) will actually 
lose information about the fold that is encoded in the chosen tzname.

In dateutil, I solved this problem by attaching the timezone object and 
checking whether the `.tzname()` of the created datetime matches the string it 
was parsed from, and if not, set fold=1 and check again - if that one matches, 
use fold=1, otherwise just return it with fold=0. This is obviously a heuristic 
metric that will not always work.

Two possible more general solutions to this problem:

1. have a variant of `strptime` that returns a `datetime` and the contents of 
`%Z` and let users or third party libraries handle converting the string into a 
timezone and attaching it to the datetime.
2. have `tzinfos` take a callable like `handle_tzinfo(dt, tzstr)` which returns 
the localized datetime.
3. have separate `tzinfos` and `apply_tzinfo` arguments, the first generating 
the `tzinfo` object, the second of the format `apply_tzinfo(dt, tz)` - if the 
second one doesn't exist, the default implementation is just `lambda dt, tz: 
dt.replace(tzinfo=tz)` (or equivalent)

#1 is a pretty significant (and possibly awkward) change to the interface, and 
#2 makes the implementation of these mappings less convenient for the 
downstream users, but is probably the most elegant from an API perspective. #3 
is a somewhat reasonable marriage of #1 and #2, but it's ugly and I'm fairly 
certain it would lead to a lot of buggy code out there from people who don't 
realize why you would need to implement the apply function.

--

___
Python tracker 

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



[issue32390] AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed

2018-01-05 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

The compilation error occurs only on the master branch, issue 32143 is the 
enhancement that is the  initial cause of this problem. This went unnoticed 
when issue 32143 was resolved because the AIX buildbots were already failing at 
that time for another reason.

--

___
Python tracker 

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



[issue32471] Add an UML class diagram to the collections.abc module documentation

2018-01-05 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue32473] Readibility of ABCMeta._dump_registry()

2018-01-05 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue32497] datetime.strptime creates tz naive object from value containing a tzname

2018-01-05 Thread Paul Ganssle

Paul Ganssle  added the comment:

This is essentially what the `tzinfos` argument to `dateutil.parser.parse` 
does. I do think something *like* this is the only reasonable way to handle 
%Z->tzinfo mappings.

In `dateutil` 
(https://dateutil.readthedocs.io/en/latest/parser.html#dateutil.parser.parse), 
you can either pass a mapping or callable. Most of the problems we have in 
dateutil relate to the fact that we're both inferring what should or should not 
be interpreted as a time zone *and* passing it to the mapping or callable. 
Given that the first problem is solved by the format specifier already having 
an option for %Z, the implementation of this would be much easier.

I think the options for how this could be implemented are:

1. Mapping only
2. Callable only
3. Mapping or callable

Callable-only will probably lead to plenty of problems, since there's *already* 
a problem in this bug report, which is that `pytz.timezone` evidently doesn't 
do what Arjan thinks it does, because that function only *happens* to work. It 
would not work with, say, `CST` or `PST`. That said, callable is the most 
versatile way to do it, and if we don't include it, then people will probably 
end up having to work around it by creating mappings whose `.get` calls 
arbitrary functions.

#1 is probably the least convenient and #3 is the most convenient. Either way, 
I'd say that the primary documented interface should be mappings, since that's 
least error-prone (these mappings could be curated by third party libraries for 
a given local context). An advantage of using mappings is that if we ever have 
a C implementation of strptime, it can have a fast evalution path for when the 
mapping is a `Dict`.

--
nosy: +belopolsky, p-ganssle

___
Python tracker 

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



[issue32390] AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed

2018-01-05 Thread STINNER Victor

STINNER Victor  added the comment:

A compilation error is a blocking bug. It is short and short, it can be
backported to 2.7 and 3.6 no? Is ALL_SOURCE defined vy default?

--

___
Python tracker 

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



[issue17972] inspect module docs omits many functions

2018-01-05 Thread R. David Murray

R. David Murray  added the comment:

Just warnings, no docs.  We've done this before for other helper functions, but 
it is always a judgement call whether it is worth the churn.  I defer to those 
people who have actually done work on the module for the answer to that 
question.

--

___
Python tracker 

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



[issue32493] UUID Module - FreeBSD build failure

2018-01-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Michael, does AIX have uint32_t?  If so, we could happily drop the unsigned32 
reference.

--

___
Python tracker 

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



[issue32497] datetime.strptime creates tz naive object from value containing a tzname

2018-01-05 Thread Arjan Keeman

Change by Arjan Keeman :


--
keywords: +patch
pull_requests: +4973
stage:  -> patch review

___
Python tracker 

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



[issue32493] UUID Module - FreeBSD build failure

2018-01-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The AIX-specific code was contributed by Michael Felt in issue32399.

--
nosy: +Michael.Felt, pitrou

___
Python tracker 

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



[issue31699] Deadlocks in `concurrent.futures.ProcessPoolExecutor` with pickling error

2018-01-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This non-trivial issue has been fixed now, thanks to Thomas' patch.  Thank you 
Thomas!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue32441] os.dup2 should return the new fd

2018-01-05 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

gcc is a little bit lost and prints now the following (false) warning:

gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -Wstrict-prototypes 
   -std=c99 -Wextra
-Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers 
-Werror=implicit-function-declaration   -I. -I./Include-DPy_BUILD_CORE  -c 
./Modules/posixmodule.c -o Modules/posixmodule.o./Modules/posixmodule.c: In 
function ‘os_dup2_impl’:
./Modules/posixmodule.c:7785:9: warning: ‘res’ may be used uninitialized in 
this function [-Wmaybe-uninitialized]
 int res;
 ^~~


The following change fools gcc that does not print anymore the warning:

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 47b79fcc79..90d73daf97 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -7845,7 +7845,7 @@ os_dup2_impl(PyObject *module, int fd, int fd2, int 
inheritable)
 }
 }
 
-if (inheritable || dup3_works == 0)
+if (inheritable || (!inheritable && dup3_works == 0))
 {
 #endif
 Py_BEGIN_ALLOW_THREADS


The change does not modify the behavior:
* dup3_works == 0 is equivalent to ((inheritable && dup3_works == 0) || 
(!inheritable && dup3_works == 0))
* (inheritable && dup3_works == 0) is always false
* hence dup3_works == 0 is equivalent to (!inheritable && dup3_works == 0)

--
nosy: +xdegaye

___
Python tracker 

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



[issue32497] datetime.strptime creates tz naive object from value containing a tzname

2018-01-05 Thread Arjan Keeman

New submission from Arjan Keeman :

Consider the following:

tz_naive_object = datetime.strptime("2018-01-05 13:10:00 CET", "%Y-%m-%d 
%H:%M:%S %Z")

Python's standard library is not capable of converting the timezone name CET to 
a tzinfo object. Therefore the case made above returns a timezone naive 
datetime object.

I propose to add an extra optional argument to _strptime.py's 
_strptime_datetime function, and to datetime.strptime: 
tzname_to_tzinfo:Optional[Callable[[str],Optional[tzinfo]]]=None. This 
parameter can be set with a function that accepts the timezone name and returns 
a tzinfo object or None (like pytz.timezone). None will mean that a timezone 
naive object will be created.

Usage:
tz_aware_object = datetime.strptime("2018-01-05 13:10:00 CET", "%Y-%m-%d 
%H:%M:%S %Z", pytz.timezone)

--
components: Library (Lib)
messages: 309502
nosy: akeeman
priority: normal
severity: normal
status: open
title: datetime.strptime creates tz naive object from value containing a tzname
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue32390] AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed

2018-01-05 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

Thanks Michael for your contribution in fixing this issue.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue32390] AIX compile error with Modules/posixmodule.c: Function argument assignment between types "unsigned long" and "struct fsid_t" is not allowed

2018-01-05 Thread Xavier de Gaye

Xavier de Gaye  added the comment:


New changeset 502d551c6d782963d26957a9e5ff1588946f233f by xdegaye (Michael 
Felt) in branch 'master':
bpo-32390: Fix compilation failure on AIX after f_fsid was added to 
os.statvfs() (#4972)
https://github.com/python/cpython/commit/502d551c6d782963d26957a9e5ff1588946f233f


--

___
Python tracker 

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



[issue25095] test_httpservers hangs since Python 3.5

2018-01-05 Thread William Pickard

William Pickard  added the comment:

Martin, your suggestion will never work as if you look at the trace back posted 
terry.reedy and my test print statements, both the client and server get stuck 
waiting to read data their respective socket, hence the deadlock. Adding the 
header "Connection" with value of "close" is logic taken from the method 
"send_error()" which is what test_err executes (same test class), that header 
along with send_error() adding the Content-Type and Content-Length headers, 
those headers are what is different between do_ERROR and do_GET, I've already 
tried locally having do_GET set both Content-Type and Content-Length headers 
without the Connection header, no difference (deadlock continued).

--

___
Python tracker 

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



[issue25095] test_httpservers hangs since Python 3.5

2018-01-05 Thread Martin Panter

Martin Panter  added the comment:

In the server, the send_header("Connection", "close") call sets the 
“close_connection” flag. This shuts down the connection once “do_GET” returns. 
Without the flag set, the server will wait and read another request.

If you want the server to shut the connection down, I suggest to be explicit in 
setting “close_connection”. It should work even if no “Connection: close” 
appears in the HTTP protocol. The special behaviour of “send_header” I think 
you are relying on is not documented.

On my Linux computer with the original code, I think the client shuts the 
connection down. This causes the server to see an empty “raw_requestline” and 
return from “handle_one_request”. It returns to “serve_forever” where it polls 
the “__shutdown_request” flag and sees that it should stop.

The client shuts down the connection only because of subtleties in how the HTTP 
client manages the socket and how sockets are garbage collected. The response 
does not have Content-Length nor Transfer-Encoding fields, and would be 
terminated by the server shutting the connection down. So the HTTPConnection 
object cannot reuse the TCP connection and hands ownership to the HTTPResponse 
object returned by “getresponse”. Since this object is not saved anywhere, it 
gets garbage collected, which closes the socket and shuts the connection down. 
But perhaps on Windows the shutdown doesn’t happen, or perhaps the garbage 
collector is too slow.

If I am right, closing the HTTPResponse object would also fix the deadlock. It 
is good practice to close the underlying socket anyway:

with support.captured_stderr() as err:
self.con.request('GET', '/')
res = self.con.getresponse()

# Shut down connection to stop the server reading from it
res.close()
self.con.close()

--

___
Python tracker 

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



[issue31699] Deadlocks in `concurrent.futures.ProcessPoolExecutor` with pickling error

2018-01-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 94459fd7dc25ce19096f2080eb7339497d319eb0 by Antoine Pitrou 
(Thomas Moreau) in branch 'master':
bpo-31699 Deadlocks in `concurrent.futures.ProcessPoolExecutor` with pickling 
error (#3895)
https://github.com/python/cpython/commit/94459fd7dc25ce19096f2080eb7339497d319eb0


--
nosy: +pitrou

___
Python tracker 

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



[issue17972] inspect module docs omits many functions

2018-01-05 Thread Paul Rudin

Paul Rudin  added the comment:

Documenting and generating a deprecation warning also makes them part of the 
documented public api. Or are you suggesting just the warning without including 
in the documentation?

Incidentally, there are also the classes BlockFinder and EndOfBlock, which are 
helpers for getblock and presumably not intended for public consumption.

--

___
Python tracker 

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



[issue32457] Windows Python cannot handle an early PATH entry containing ".." and python.exe

2018-01-05 Thread Eryk Sun

Eryk Sun  added the comment:

For extra measure, you may want to normalize `prefix` prior to calculating its 
length n in gotlandmark(). Then it would be reliable to truncate it via 
`prefix[n] = '\0'` after joining with `landmark`. Or at least add a comment 
there or in the calling function, search_for_prefix(), that gotlandmark assumes 
the current value of `prefix` is a canonical, normalized path.

--

___
Python tracker 

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



[issue32495] Adding Timer to multiprocessing

2018-01-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The threading.Timer class is in my experience little used, for two reasons:
1) it's not very flexible (no periodic calls, no restart...)
2) it's not efficient (as it creates a new thread for each timer)
3) (third optional reason) many applications needing time management actually 
use an event loop of some kind, as the need for time management is often 
coupled with the requirement to do network I/O

A hypothetical multiprocessing.Timer would have the same drawbacks as 
threading.Timer, the inefficiency being of course much worse.

--

___
Python tracker 

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