[issue32439] Clean up the code for compiling comparison expressions

2017-12-29 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 02b9ef27752ff4873c592ac3afe7e3410f715984 by Serhiy Storchaka in 
branch 'master':
bpo-32439: Clean up the code for compiling comparison expressions. (#5029)
https://github.com/python/cpython/commit/02b9ef27752ff4873c592ac3afe7e3410f715984


--

___
Python tracker 

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



[issue32452] Brackets and Parentheses used in an ambiguous way

2017-12-29 Thread kandhan

kandhan  added the comment:

"round brackets instead of square brackets" sounds better.

Its simple and direct and doesn't require any extra operations other than the 
required one.

--

___
Python tracker 

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



[issue32452] Brackets and Parentheses used in an ambiguous way

2017-12-29 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

In British, Australian, New Zealander, and Indian English (and sometimes 
Canada), at least, "bracket" on its own typically means round brackets () and 
is rarely if ever used for square brackets [] or curly brackets {} without the 
adjective.

See for example 
https://english.stackexchange.com/questions/168762/brackets-vs-parenthesis for 
a discussion.

Consequently, the phrase "parentheses instead of brackets" reads to us as 
"parentheses instead of parentheses" would to Americans. In other words, weird 
and requiring a moment (or three) of thought to translate.

I support the suggested change to "parentheses instead of square brackets" -- 
it should read more naturally to people in the British Commonwealth and (I 
hope) shouldn't look too strange to Americans.

My personal preference would be for "round brackets instead of square 
brackets", but I guess that will be a battle I have no hope of winning *wink*

--
nosy: +steven.daprano

___
Python tracker 

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



[issue23749] asyncio missing wrap_socket (starttls)

2017-12-29 Thread Yury Selivanov

Change by Yury Selivanov :


--
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



[issue23749] asyncio missing wrap_socket (starttls)

2017-12-29 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset f111b3dcb414093a4efb9d74b69925e535ddc470 by Yury Selivanov in 
branch 'master':
bpo-23749: Implement loop.start_tls() (#5039)
https://github.com/python/cpython/commit/f111b3dcb414093a4efb9d74b69925e535ddc470


--

___
Python tracker 

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



[issue32453] shutil.rmtree can have O(n^2) performance on large dirs

2017-12-29 Thread Niklas Hambüchen

New submission from Niklas Hambüchen :

See http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=24412edeaf556a 
for the explanation and equivalent fix in coreutils.

The gist ist that deleting entries in inode order can improve deletion 
performance dramatically.

To obtain inode numbers and sort by them, one needs to `getdents()` all the 
entries ahead of time, but rmtree() already gets all dirents ahead of the 
deletion. https://bugs.python.org/issue28564 recently improved shutil.rmtree() 
performance by using scandir(), but nevertheless the returned generator is 
list()ed, so we already have all necessary informtaion in memory and would just 
have to perform an O(n) integer sort.

I propose we check if the improvements made to `rm -r` in coreutils should be 
ported to shutil.rmtree().

--
components: Library (Lib)
messages: 309217
nosy: nh2
priority: normal
severity: normal
status: open
title: shutil.rmtree can have O(n^2) performance on large dirs
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



[issue28564] shutil.rmtree is inefficient due to listdir() instead of scandir()

2017-12-29 Thread Niklas Hambüchen

Niklas Hambüchen  added the comment:

I've filed https://bugs.python.org/issue32453, which is about O(n^2) deletion 
behaviour for large directories.

--
nosy: +nh2

___
Python tracker 

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



[issue32452] Brackets and Parentheses used in an ambiguous way

2017-12-29 Thread kandhan

kandhan  added the comment:

In the above comment,

Line 1 is the URL where it needs improvement

Line 2 and 3 are the actual content in the page that needs improvement

Line 4 is the proposed solution

--

___
Python tracker 

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



[issue32452] Brackets and Parentheses used in an ambiguous way

2017-12-29 Thread kandhan

New submission from kandhan :

https://docs.python.org/3/tutorial/classes.html

9.10. Generator Expressions

Some simple generators can be coded succinctly as expressions using a syntax 
similar to list comprehensions but with "parentheses instead of brackets"

Since parentheses comes under brackets, brackets could be changed to "Square 
Brackets"

--
assignee: docs@python
components: Documentation
messages: 309216
nosy: docs@python, kandhan
priority: normal
severity: normal
status: open
title: Brackets and Parentheses used in an ambiguous way
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-12-29 Thread Nick Coghlan

Change by Nick Coghlan :


--
keywords: +patch
pull_requests: +4929
stage: needs patch -> patch review

___
Python tracker 

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



[issue32451] python -m venv activation issue when using cygwin on windows

2017-12-29 Thread Kevin

New submission from Kevin :

attempts from within cygwin:

1. The Posix way:

$ python -m venv taco
$ cd taco
$ source bin/activate
-bash: $'\r': command not found
-bash: Scripts/activate: line 4: syntax error near unexpected token `$'{\r''
'bash: Scripts/activate: line 4: `deactivate () {

2. The windows way:

$ python -m venv taco
$ cd taco
$ /full/path/to/venv/taco/scripts/activate.bat
$


3. the only solution from cygwin (still not 100% functional):

$ python -m venv taco
$ cd taco
$ cd Scripts
$ cmd
C:\taco\Scripts\> activate.bat

(taco) C:\taco\Scripts\>




HOWEVER. when running "pip freeze" in number 3 it returns the system packages 
despite the "include-system-site-packages = False" in pyvenv.cfg 
When #3 is run inside command prompt "pip freeze" returns nothing correctly.


Come on guys, please don't make me use command prompt or powershell.

--
messages: 309215
nosy: Kevin
priority: normal
severity: normal
status: open
title: python -m venv activation issue when using cygwin on windows
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-12-29 Thread Nick Coghlan

Change by Nick Coghlan :


--
assignee:  -> ncoghlan

___
Python tracker 

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



[issue10381] Add timezone support to datetime C API

2017-12-29 Thread Nick Coghlan

Nick Coghlan  added the comment:

Would it be possible to deprecate (or at least stop enhancing) the current 
datetime C API and add a new capsule based one instead?

We're trying to get extension module authors to *stop* relying on C level 
globals, since it causes problems with:

- memory usage analysis
- interpreter reinitialisation
- module reloading
- subinterpreters

Unfortunately, the current design of the datetime C API *requires* the use of C 
level global state.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue30449] Improve __slots__ datamodel documentation

2017-12-29 Thread mpb

mpb  added the comment:

Can __slots__ be assigned a string?  If so, what are the consequences?  I find 
the current docs lack clarity.  For example from the docs for 3.7.0a3:

https://docs.python.org/3.7/reference/datamodel.html#slots

>  3.3.2.4. __slots__
>
>  [snip]
>
>  object.__slots__
>This class variable can be assigned a string,
>iterable, or sequence of strings [snip]

However, "3.3.2.4.1. Notes on using __slots__" does not discuss what happens 
when a string is assigned to __slots__.

The "notes" section does discuss assigning a "sequence of strings" to __slots__.

The "notes" section also says: "Any non-string iterable may be assigned to 
__slots__."

Based on quick experimentation, it appears that the string must be a single 
identifier.  I get a TypeError if I try to assign "foo bar" to __slots__.  The 
consequence of a string appears to be that only a single slot is created.  It 
would be nice if this was stated clearly in the docs.

The docs for 2.7 seem similar to version 3.7.0a3.  So maybe all versions of the 
docs could be improved regarding the specifics of what happens when you assign 
a string to __slots__.

--
nosy: +mpb

___
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

2017-12-29 Thread Yuri Kanivetsky

New submission from Yuri Kanivetsky :

Not a big issue, really. At some point the code switches from "ndots" name:

https://github.com/python/cpython/blob/v3.7.0a3/Python/ast.c#L3385

to "level" name:

https://github.com/python/cpython/blob/v3.7.0a3/Python/Python-ast.c#L1671

Be it "ndots" everywhere, it could save me some time.

--
messages: 309212
nosy: Yuri Kanivetsky
priority: normal
severity: normal
status: open
title: non-descriptive variable name
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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-29 Thread Nick Coghlan

Nick Coghlan  added the comment:

Another point in favour of the JSR approach is that it should make it
easier for tools like coverage.py to continue mapping opcode coverage to
line coverage.

I also like Serhiy's proposed strategy of separating the initial
introduction of the compiler based exception handling from the subsequent
simplification of the exception handling opcodes.

--

___
Python tracker 

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



[issue32426] Tkinter.ttk Widget does not define wich option exists to set the cursor

2017-12-29 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The tkinter docs currently omit much, but refer one to, among other places, 
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html, which has a page 
with images and names.
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/cursors.html

--
nosy: +serhiy.storchaka, terry.reedy

___
Python tracker 

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



[issue32421] Keeping an exception in cache can segfault the interpreter

2017-12-29 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Yonathon, when replying by email, please delete the quoted message, except 
possibly for a specific line,  as it is redundant noise when posted on the web 
page.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue32420] LookupError : unknown encoding : [0x7FF092395AD0] ANOMALY

2017-12-29 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Since there is no evident CPython bug, I am closing this.  If CPython gets a 
bogus encoding for the std streams, it cannot output a normal traceback on 
sys.stderr.

>From StackOverflow: "TensorFlow is an open source library for machine learning 
>and machine intelligence. It is developed by Google and became open source in 
>November 2015."  It obviously has a python binding as there are numerous 
>questions tagged with both.

I searched SO for "[tensorflow] ANOMALY" and the 29 hits were about anomaly 
detection, as in detecting credit card fraud.  Suspecting that the error is not 
tensorflow specific, I searched "[anaconda] ANOMALY" and got the following, 
which reports a nearly identical error message, but with scikit-learn.
https://stackoverflow.com/questions/42732377/how-to-install-scikit-0-19-dev-version-in-anaconda
The advice was to reinstall after rechecking instructions.

--
nosy: +terry.reedy
resolution:  -> third party
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



[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-29 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4928
stage:  -> patch review

___
Python tracker 

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



[issue28134] socket.socket(fileno=fd) does not work as documented

2017-12-29 Thread Christian Heimes

Christian Heimes  added the comment:

Yuri,

* The patch is purely about Python's view of the socket. The actual behavior of 
the OS socket fd is not influenced by socket.socket()'s family, type and 
protocol. However the especially the family is critical for Python because a 
lot of socket code uses the family to decide how to format its address or the 
peer address.

* On some platforms and/or for some socket types, it is not possible to get the 
address family or type unless connect() or bind() have been called. On Linux it 
seems to work for both new sockets and bound/connected sockets. On Windows it 
never works for a fresh socket.

* It looks like Windows doesn't have protocol dedicated and always uses 0 as 
protocols.

* Using the wrong type is less of an issue. Using the wrong family is really 
really bad, see https://bugs.python.org/issue28134#msg285972.

* I don't care much about validating the values. I'm concerned to have correct 
values by default. Validation can be implemented in a separate PR. In that case 
we want to add socket.closefd(fd: int). On Windows os.close() can't be used for 
socket fds.

--

___
Python tracker 

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



[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-29 Thread Yahya Abou Imran

Yahya Abou Imran  added the comment:

And I just saw that Raymon Hettinger made it inherting from Sized:

https://github.com/python/cpython/blame/master/Lib/_collections_abc.py#L694

So I we were to ahve his opinion on this...

--

___
Python tracker 

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



[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-29 Thread Yahya Abou Imran

Yahya Abou Imran  added the comment:

https://mail.python.org/pipermail/python-ideas/2017-December/048489.html

Guido is waiting for objection on this...

I have absolutly no idea why this decision was made.

These tests 
(ttps://github.com/python/cpython/blame/master/Lib/test/test_collections.py#L794):

non_col_iterables = [_test_gen(), iter(b''), iter(bytearray()),
 (x for x in []), dict().values()]
for x in non_col_iterables:
self.assertNotIsInstance(x, Collection)

were written by Guido himself.

--

___
Python tracker 

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



[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-29 Thread R. David Murray

R. David Murray  added the comment:

Well, it would be a backward compatibility problem at a minimum.

Obviously things were designed this way.  Have you found out why?  Is there a 
consensus on python-ideas that this should be changed?  If so, please link to 
the thread.

--
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



[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-29 Thread Yahya Abou Imran

Yahya Abou Imran  added the comment:

Quoting my own post on python-ideas:

After I generate an UML diagram from collections.abc, I found very strange that 
MappingView inherit from Sized instead of Collection (new in python 3.6).

Yes, MappingView only define __len__ and not __iter__ and __contains__, but all 
of its subclasses define them (KeysView, ValuesView and ItemViews).

I tried to run the tests in test/test_collections.py after making this change 
and on only one fail :

Traceback (most recent call last):
  File "/usr/lib/python3.6/test/test_collections.py", line 789, in 
test_Collection
self.assertNotIsInstance(x, Collection)
AssertionError: dict_values([]) is an instance of 

Wich is absolutely wrong, since in reality a dict_values instance has the 
behaviour of a Collection:

>>> vals = {1:'a', 2: 'b'}.values()
>>> 'a' in vals
True
>>> 'c' in vals
False
>>> len(vals)
2
>>> for val in vals:
... print(val)
...
a
b

The only lack is that it doesn't define a __contains__ method:

>>> '__contains__' in vals
False

It uses __iter__ to find the presence of the value.

But, hey: we have register() for this cases! In fact, when MappingView inherit 
from Collection, dict_values is considered as a subclass of Collection since 
it's in the register of ValuesView, causing the above bug...
So, the test have to be changed, and dict_values must be placed in the samples 
that pass the test, and not in the ones that fail it.

Here is a patch file for this.

The only problem in this is that the MappingView won't be instatiable anymore 
because of the lack of __contains__ and __iter__.

But since - if my understanding is correct - it's just an "utilty" super class 
for three other views (so is Collection for Set, Mapping and Sequence), it's 
not a big deal IMHO.

--
keywords: +patch
Added file: https://bugs.python.org/file47354/mypatch.patch

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-29 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I consider PR 5006 as just a first step. I had two goals:

1) Fix all regressions in PR 2827. First at all the regression in the f_lineno 
setter.

2) Simplify the patch. This is critically important for getting the review. 
And it decreases the chance of regressions. All changes not directly related 
to the main goal (declared in the title of this issue) were removed. Other 
nice improvements can be made in separate PRs.

Maybe finally we will came to the duplication of the code. But this will 
require making other small steps which can have their own value.

--

___
Python tracker 

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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-29 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

cancel will work in my case, but it's somewhat limited.

In other hand it's probably a job of a testing library to provide an utility 
function.

--

___
Python tracker 

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



[issue32449] MappingView must inherit from Collection instead of Sized

2017-12-29 Thread Yahya Abou Imran

New submission from Yahya Abou Imran :

Quoting my own post on python-ideas:

After I generate an UML diagram from collections.abc, I found very strange that 
MappingView inherit from Sized instead of Collection (new in python 3.6).

Yes, MappingView only define __len__ and not __iter__ and __contains__, but all 
of its subclasses define them (KeysView, ValuesView and ItemViews).

I tried to run the tests in test/test_collections.py after making this change 
and on only one fail :

Traceback (most recent call last):
  File "/usr/lib/python3.6/test/test_collections.py", line 789, in 
test_Collection
self.assertNotIsInstance(x, Collection)
AssertionError: dict_values([]) is an instance of 

Wich is absolutely wrong, since in reality a dict_values instance has the 
behaviour of a Collection:

>>> vals = {1:'a', 2: 'b'}.values()
>>> 'a' in vals
True
>>> 'c' in vals
False
>>> len(vals)
2
>>> for val in vals:
... print(val)
...
a
b

The only lack is that it doesn't define a __contains__ method:

>>> '__contains__' in vals
False

It uses __iter__ to find the presence of the value.

But, hey: we have register() for this cases! In fact, when MappingView inherit 
from Collection, dict_values is considered as a subclass of Collection since 
it's in the register of ValuesView, causing the above bug...
So, the test have to be changed, and dict_values must be placed in the samples 
that pass the test, and not in the ones that fail it.

--
messages: 309200
nosy: yahya-abou-im...@protonmail.com
priority: normal
severity: normal
status: open
title: MappingView must inherit from Collection instead of Sized
type: enhancement
versions: 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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-29 Thread Yury Selivanov

Yury Selivanov  added the comment:

> My use case was outside control of otherwise unconditionally blocking task 
> (for tests only). What replacement (if any) would you suggest?


Use Task.cancel() or use a Queue to communicate with the task.  Your test code 
was working, but ultimately was creating an unexpected (and not officially 
documented/supported) situation for the task.

--

___
Python tracker 

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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-29 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

Andrew, Yury

I test my lib against dev versions of Python and recently got an error in one 
of the tests due to the deprecation.

I do not argue the reason behind removing this methods, but Task.set_exception 
was working for me in tests: 
https://github.com/Kentzo/async_app/blob/250ee7a05d2af8035806ce1d86f57d0f00283db0/tests/test_utils.py#L73-L91

My use case was outside control of otherwise unconditionally blocking task (for 
tests only). What replacement (if any) would you suggest?

--
nosy: +Ilya.Kulakov

___
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

2017-12-29 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset bbdb17d19bb1d5443ca4417254e014ad64c04540 by Benjamin Peterson in 
branch 'master':
return the new file descriptor from os.dup2 (closes bpo-32441) (#5041)
https://github.com/python/cpython/commit/bbdb17d19bb1d5443ca4417254e014ad64c04540


--
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

2017-12-29 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

My reading of the Linux signalfd man page may be optimistic. :)

Regardless, it'd be nice to have it available in the stdlib so it could be used 
if deemed useful.  I expect this to only ever be added by someone making use of 
it in another stdlib module.

As for what multiprocessing.forkserver does, the old manual signal handler and 
pipe trick is a reasonably well known one.  But a forkserver is not safe to be 
started when threads exist.  (unlike subprocess)

Signals are process global state, no thread compatible library can rightfully 
take ownership of a one.

--
priority: normal -> low

___
Python tracker 

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



[issue32447] IDLE shell won't open on Mac OS 10.13.1

2017-12-29 Thread Ned Deily

Ned Deily  added the comment:

Those messages at the top of your terminal sessions are pretty suspicious, e.g. 
"Permission denied" and "No such file or directory".  They suggest a home 
directory ownership or permissions issue which you should investigate.  But 
definitely try running IDLE from the terminal window as Terry suggests.  If 
nothing else, you may see more informative error messages.

--

___
Python tracker 

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



[issue32447] IDLE shell won't open on Mac OS 10.13.1

2017-12-29 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

IDLE uses Python's tcl/tk interface module, called 'tkinter'.  Tcl is a 
separate language and tk is its graphical user interface.  This is most likely 
the problem.  Did you follow the advice at
https://www.python.org/download/mac/tcltk/
to install tcl/tk 8.5.18?  Make sure you read the whole page.

To test better, run 'import tkinter' at Python's interactive '>>>' prompt.  Any 
error message?  If that works, run 'python3.6 -m idlelib' and/or 'python -m 
idlelib.idle' at the terminal '...$' prompt.  Does that display an error 
message?

--
components: +Installation, macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue18035] telnetlib incorrectly assumes that select.error has an errno attribute

2017-12-29 Thread Gregory P. Smith

Change by Gregory P. Smith :


--
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



[issue18035] telnetlib incorrectly assumes that select.error has an errno attribute

2017-12-29 Thread Gregory P. Smith

Gregory P. Smith  added the comment:


New changeset 3ceaed0dce81fd881bbaf2dbdbe827d9681887da by Gregory P. Smith 
(Segev Finer) in branch '2.7':
bpo-18035: telnetlib: select.error doesn't have an errno attribute (#5044)
https://github.com/python/cpython/commit/3ceaed0dce81fd881bbaf2dbdbe827d9681887da


--

___
Python tracker 

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



[issue32448] subscriptable

2017-12-29 Thread R. David Murray

R. David Murray  added the comment:

At the point at which that error is raised, Python doesn't know the name of the 
attribute, nor is attribute access the only place where that particular error 
report is triggered (it's in a generic subscript-this-object call).  So I doubt 
doing this would be practical.

As for Foo.organizer.blah[0], it has to be blah that is None, since 
'.organizer' is an attribute access and not a subscript operation.  The more 
difficult case is something like getattr(someobject, somevar)[0], where you 
can't tell what somevar contains just from the traceback.  Which is why some 
value-added systems also dump the locals from the frame in the traceback.

--
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



[issue32221] Converting ipv6 address to string representation using getnameinfo() is wrong.

2017-12-29 Thread Yury Selivanov

Yury Selivanov  added the comment:

> So, PR is ready. Please review.

I understand, however I still don't have time for it at the moment. If another 
core dev wants to take initiative, please by all means do.

I can/will take another look at this after January 15.

--

___
Python tracker 

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



[issue32221] Converting ipv6 address to string representation using getnameinfo() is wrong.

2017-12-29 Thread Марк Коренберг

Марк Коренберг  added the comment:

So, PR is ready. Please review.

--

___
Python tracker 

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



[issue32428] dataclasses: make it an error to have initialized non-fields in a dataclass

2017-12-29 Thread Guido van Rossum

Guido van Rossum  added the comment:

I liked the original design better, where things without annotations would
just be ignored. What changed?

On Dec 27, 2017 5:19 PM, "Ivan Levkivskyi"  wrote:

>
> Ivan Levkivskyi  added the comment:
>
> > I'm not sure I understand the distinction.
>
> Initially I thought about only flagging code like this:
>
> @dataclass
> class C:
> x = field()
>
> But not this:
>
> @dataclass
> class C:
> x = 42
>
> Now I think we should probably flag both as errors.
>
> > How do we only pick out `y` and probably `prop`, and ignore the rest,
> without being overly fragile to new things being added? I guess ignoring
> dunders and things in `__annotations__`. Is that close enough?
>
> We had a similar problem while developing Protocol class (PEP 544).
> Currently we just a have a whitelist of names that are skipped:
>
> '__abstractmethods__', '__annotations__', '__weakref__', '__dict__',
> '__slots__', '__doc__', '__module__'
>
> (plus some internal typing API names)
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue32427] Rename and expose dataclasses._MISSING

2017-12-29 Thread Eric V. Smith

Change by Eric V. Smith :


--
resolution:  -> fixed
stage: patch review -> resolved
type:  -> behavior

___
Python tracker 

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



[issue32427] Rename and expose dataclasses._MISSING

2017-12-29 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset 03220fdb26c0b6a50ce5ed1fdfbf232094b66db6 by Eric V. Smith in 
branch 'master':
bpo-32427: Expose dataclasses.MISSING object. (#5045)
https://github.com/python/cpython/commit/03220fdb26c0b6a50ce5ed1fdfbf232094b66db6


--

___
Python tracker 

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



[issue32448] subscriptable

2017-12-29 Thread Alexander Mohr

New submission from Alexander Mohr :

Currently subscriting a attribute that's None reports the following:
>>> class Foo: pass
>>> Foo.organizer = None
>>> Foo.organizer['start']
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'NoneType' object is not subscriptable

What would be nice is if it were to report the name of the attribute that is 
not subscriptable as it would greatly help in the logs, something like:

Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'NoneType' object of attribute 'organizer' is not subscriptable

just a thought.  Otherwise one would need to sprinkle their code with asserts, 
especially if it's a compound statement like:
Foo.organizer.blah[0], you wouldn't know which attribute wasn't None

--
components: Interpreter Core
messages: 309187
nosy: thehesiod
priority: normal
severity: normal
status: open
title: subscriptable
type: enhancement
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue12706] timeout sentinel in ftplib and poplib documentation

2017-12-29 Thread Marcel Widjaja

Marcel Widjaja  added the comment:

Greg, I wonder if you are planning to submit a PR for your patch? If not, I'm 
plan to take your patch, make some minor adjustment and submit a PR.

--
nosy: +mawidjaj

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-29 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

I apologize if my extra PR is causing confusion.  My original intention was to 
merely forward port Antoine changes so they could compile with the 'master' 
version of Python.  Over time I have made some fixes to it.  I have kept it 
open because I'm not sure which approach is better (JSR or duplication).

I did a quick test on the .pyc code size increase.  It is actually tiny for the 
Python code in Lib/.

PR 5006: 21259894 bytes
PR 4682: 21263081 bytes (+0.015%)

Running Serhiy's microbenchmarks:

for i in a:
try: pass
finally: pass

PR 4682: Mean +- std dev: 11.0 us +- 0.1 us
PR 5006: Mean +- std dev: 10.9 us +- 0.6 us


for i in a:
try: continue
finally: pass

PR 4682: Mean +- std dev: 9.46 us +- 0.85 us
PR 5006: Mean +- std dev: 14.3 us +- 0.3 us


for i in a:
while True:
try: break
finally: pass

PR 4682: Mean +- std dev: 9.20 us +- 0.09 us
PR 5006: Mean +- std dev: 14.3 us +- 0.6 us

--

___
Python tracker 

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



[issue32424] Synchronize copy methods between Python and C implementations of xml.etree.ElementTree.Element

2017-12-29 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

There is an existing test for copying. No new tests are needed. Just add a case 
for the copy() method in test_copy.

Special __deepcopy__() method for Python implementation is not needed. 
copy.deepcopy() already works well.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31907] Clarify error message when attempting to call function via str.format()

2017-12-29 Thread mickey695

mickey695  added the comment:

Well, it has been more than the 2 weeks I promised however now I finally have 
time to look into this.

I did some fuzzing to build a list quickly and the following ASCII characters 
can not be used as part of the argument name:
exclamation mark(!)
period(.)
colon(:)
opening square bracket([)
opening/closing curly brackets({})

also, the argument name may not start with digits from zero to nine(0-9)

Basically what needs to be changed is arg_name under the section "Format String 
Syntax" in \Doc\library\string.rst

Problem is, I really don't understand the syntax of the Python/sphinx formal 
language.

The following expression is what I came up with:
arg_name ::= [^`decinteger`] [ | `integer` ]+

If anyone from the documentation team could look into it I would be grateful.

Moreover, I think attribute_name should probably be changed as it does not have 
to be a valid identifier. In fact, it can be any text. Eric V. Smiths' example 
can be used with any text as the attribute name. A comment should be added to 
the aforementioned section explaining that normally only valid identifiers are 
accepted, however by implementing your own __getattr__ this can be changed.

--
components: +Documentation

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Whether the small speed difference is worth worrying about is a different 
> matter.

I don't think so.  Though one could run the benchmarks suite to get an idea of 
the impact on real-world code.

--

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-29 Thread Mark Shannon

Mark Shannon  added the comment:

When I said "significant", I meant from a statistically, not as a judgement 
meaning "useful" or "worthwhile". The code duplication approach is 
significantly faster in the tests. Whether the small speed difference is worth 
worrying about is a different matter.

Also, the comparisons were with each other, not the current interpreter. Both 
approaches are better than the current implementation.

One point I didn't cover is jumping to a new line in the debugger.
Implementing that reliably for finally blocks with code duplication is tricky 
and would mean adding a number of marker bytecodes.
Which is a big point in favour of the JSR style.

If we are going to use the JSR approach, we should do it properly. 
PR 5006 still has elements of the current design such as the overly complex 
END_FINALLY, WITH_CLEANUP_START and WITH_CLEANUP_FINISH bytecodes. None of 
those should be necessary.

--

___
Python tracker 

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



[issue32447] IDLE shell won't open on Mac OS 10.13.1

2017-12-29 Thread Steve Margetts

New submission from Steve Margetts :

I am trying to install Python on a Max running OS 10.13.1 (so my son can use a 
'Coding for Beginners' book). Both 2.7 and 3.6 have the same problem: Clicking 
on IDLE leads to the icon bouncing a couple of times in the dock, but not 
opening a shell. I have tried re-installing and restarting post install. Typing 
python or python3.6 into the terminal seems to launch Python successfully 
(details below). I am as new to coding as my son, please phrase any advice 
accordingly!

Thank you.

Last login: Fri Dec 29 16:26:57 on ttys000
mkdir: /Users/Steve Margetts/.bash_sessions: Permission denied
touch: /Users/Steve 
Margetts/.bash_sessions/79B2448C-E769-409D-A67D-7A96F8C3C348.historynew: No 
such file or directory
iMac:~ Steve Margetts$ python
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 12:01:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help
Type help() for interactive help, or help(object) for help about object.
>>>

Last login: Fri Dec 29 16:30:16 on ttys000
mkdir: /Users/Steve Margetts/.bash_sessions: Permission denied
touch: /Users/Steve 
Margetts/.bash_sessions/5A516AB8-0481-4D55-A2BD-1B1017E52147.historynew: No 
such file or directory
iMac:~ Steve Margetts$ python3.6
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

--
assignee: terry.reedy
components: IDLE
messages: 309180
nosy: sm1979, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE shell won't open on Mac OS 10.13.1
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue32424] Synchronize copy methods between Python and C implementations of xml.etree.ElementTree.Element

2017-12-29 Thread Gordon P. Hemsley

Gordon P. Hemsley  added the comment:

Given the discussion, I've gone ahead and created a new PR that synchronizes 
the three copy methods between implementations and deprecates Element.copy().

--

___
Python tracker 

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



[issue32424] Synchronize copy methods between Python and C implementations of xml.etree.ElementTree.Element

2017-12-29 Thread Gordon P. Hemsley

Change by Gordon P. Hemsley :


--
title: Rename copy() to __copy__() in xml.etree.ElementTree.Element Python 
implementation -> Synchronize copy methods between Python and C implementations 
of xml.etree.ElementTree.Element

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-29 Thread Gordon P. Hemsley

Change by Gordon P. Hemsley :


--
pull_requests: +4927

___
Python tracker 

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



[issue32446] ResourceLoader.get_data() should accept a PathLike

2017-12-29 Thread Barry A. Warsaw

New submission from Barry A. Warsaw :

Currently get_data() only accepts a string.  It should also accept a os.PathLike

--
messages: 309178
nosy: barry, brett.cannon
priority: normal
severity: normal
status: open
title: ResourceLoader.get_data() should accept a PathLike
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



[issue32429] Outdated Modules/Setup warning is invisible

2017-12-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I'm ok with turning the warning into an error. Does anyone object here?

--

___
Python tracker 

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



[issue32145] Wrong ExitStack Callback recipe

2017-12-29 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Dec 29, 2017, at 08:40, Nick Coghlan  wrote:
> 
> I'm not clear on what you mean about allowing arbitrary names for the 
> instance creation function -

What I meant was that I don’t see `def _make_instance()` defined in your 
example, so I didn’t know if that was part of the contract between the base and 
derived classes, or an “arbitrary method” that subclasses can come up with.  
From the example, it seems like the latter, but I could be misunderstanding 
your proposal.

> at that point we're back to subclasses not being able to use the default 
> `pop_all()` implementation at all, and needing to duplicate the state 
> transfer logic in the subclass (which we don't provide a public API to do, 
> since the `_exit_callbacks` queue is deliberately private).
> 
> However, I'm thinking we could potentially change `pop_all` *itself* to 
> accept a target object:
> 
>def pop_all(self, *, target=None):
>"""Preserve the context stack by transferring it to a new instance
> 
>If a *target* stack is given, it must be either an `ExitStack`
>instance, or else provide a callback registration method akin to 
> `ExitStack.callback`.
>"""
>if target is None:
>target = type(self)()
>exit_callbacks = self._exit_callbacks
>self._exit_callbacks = deque()
>if isinstance(target, ExitStack):
>target._exit_callbacks = exit_callbacks
>else:
>for cb in exit_callbacks:
>target.callback(cb)
>return target
> 
> The recipe fix would then be to make `Callback.cancel()` look like:
> 
>def cancel(self):
># We deliberately *don't* clean up the cancelled callback
>self.pop_all(target=ExitStack())

That’s actually not bad.  I think I like that better than the (IMHO, misnamed) 
_clone() API.  I’d quibble just a bit about the docstring, since the required 
API for target is exactly that it have a .callback() method that accepts a 
single exit callback argument.

--

___
Python tracker 

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



[issue32427] Rename and expose dataclasses._MISSING

2017-12-29 Thread Eric V. Smith

Change by Eric V. Smith :


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

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-29 Thread R. David Murray

R. David Murray  added the comment:

Correct, a new feature should always get a what's new entry.  You could submit 
a PR for it :)

--

___
Python tracker 

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



[issue32444] python -m venv symlink dependency on how python binary is called is not documented

2017-12-29 Thread R. David Murray

R. David Murray  added the comment:

Actually, I'm going to reopen this as a doc issue because this behavior is not 
discussed by the docs that I can see, and it is important to know about when 
creating a venv.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
resolution: not a bug -> 
stage: resolved -> needs patch
status: closed -> open
title: python -m venv has incongruous behavor creating binaries -> python -m 
venv symlink dependency on how python binary is called is not documented

___
Python tracker 

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



[issue32444] python -m venv has incongruous behavor creating binaries

2017-12-29 Thread R. David Murray

R. David Murray  added the comment:

This is a feature that actually supports your use case, as well as the use 
cases of those who *don't* want to strap the python version: you get what you 
ask for.  If you call venv with 'python3', you get a venv that will use your 
new python if you upgrade your python, but if you call it with python3.x, you 
will get a venv that will *not* upgrade, which is exactly what you want for 
your use case.

--
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



[issue32145] Wrong ExitStack Callback recipe

2017-12-29 Thread Nick Coghlan

Nick Coghlan  added the comment:

I'm not clear on what you mean about allowing arbitrary names for the instance 
creation function - at that point we're back to subclasses not being able to 
use the default `pop_all()` implementation at all, and needing to duplicate the 
state transfer logic in the subclass (which we don't provide a public API to 
do, since the `_exit_callbacks` queue is deliberately private).

However, I'm thinking we could potentially change `pop_all` *itself* to accept 
a target object:

def pop_all(self, *, target=None):
"""Preserve the context stack by transferring it to a new instance

If a *target* stack is given, it must be either an `ExitStack`
instance, or else provide a callback registration method akin to 
`ExitStack.callback`.
"""
if target is None:
target = type(self)()
exit_callbacks = self._exit_callbacks
self._exit_callbacks = deque()
if isinstance(target, ExitStack):
target._exit_callbacks = exit_callbacks
else:
for cb in exit_callbacks:
target.callback(cb)
return target

The recipe fix would then be to make `Callback.cancel()` look like:

def cancel(self):
# We deliberately *don't* clean up the cancelled callback
self.pop_all(target=ExitStack())

(Tangent: https://bugs.python.org/issue32445 suggests adding a small 
optimisation to `ExitStack.callback` to skip adding the wrapper when `args` and 
`kwds` are both empty)

--

___
Python tracker 

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



[issue32445] Skip creating redundant wrapper functions in ExitStack.callback

2017-12-29 Thread Nick Coghlan

New submission from Nick Coghlan :

While discussing https://bugs.python.org/issue32145, I noticed that 
ExitStack.callback *always* adds a wrapper function, even when the `args` and 
`kwds` parameters are both empty.

For plain callbacks that aren't receiving any extra arguments, it would be 
better to skip adding the redundant wrapper function.

--
messages: 309171
nosy: barry, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Skip creating redundant wrapper functions in ExitStack.callback
type: performance
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue18035] telnetlib incorrectly assumes that select.error has an errno attribute

2017-12-29 Thread Segev Finer

Change by Segev Finer :


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

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 29/12/2017 à 12:48, Mark Shannon a écrit :
> 
> Why all these competing pull requests? It does feel like my original patch 
> has been hijacked.

The original patch had a number of issues which needed to be fixed (in
addition to forward-port it to the latest git master), such as not
fixing some cases of stack consumption calculation.

> Also, before any more PRs, we need to decide whether to use subroutines or 
> code duplication for finally blocks.
> 
> Here is my attempt at an objective comparison of the two approaches.
> 
>JSR style   Code duplication
> Speed  Slower  Faster
> InterpreterMore complexSimpler
> Bytecode generationSimpler More complex
> Bytecode size  ~ +0.1% ~ +0.4%

Actually, when looking at your original patch
(https://bugs.python.org/review/17611/) vs. Serhiy's
https://github.com/python/cpython/pull/5006/, it looks like interpreter
complexity is the same.  Speed also seems to not be significantly
different.  So I would rephrase it as (compared to legacy bytecode
generation):

  Subroutine  Code duplication
Speed SameInsignificantly faster
Interpreter   Simpler Simpler
Bytecode generation   Slightly more complex   Slightly more complex
Bytecode size ~ +0.1% ~ +0.4%

That said, if you want to submit an updated version of the code
duplication approach (with the same amount of added tests and
debugging), we could compare on more equal grounds.

--

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-29 Thread Mark Shannon

Mark Shannon  added the comment:

Why all these competing pull requests? It does feel like my original patch has 
been hijacked.

Also, before any more PRs, we need to decide whether to use subroutines or code 
duplication for finally blocks.

Here is my attempt at an objective comparison of the two approaches.

   JSR style   Code duplication
Speed  Slower  Faster
InterpreterMore complexSimpler
Bytecode generationSimpler More complex
Bytecode size  ~ +0.1% ~ +0.4%

The increase in bytecode size is insignificant in terms of overall memory use, 
but the performance increase is significant (although small).

Unless I have missed anything important, this says to me that the code 
duplication approach is better.

--

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-29 Thread Mathieu Dupuy

Mathieu Dupuy  added the comment:

maybe it's worth adding an entry in python 3.7 "what's new" ? I think it was a 
very long awaited issue.
The opposite of isoformat() is a very frequent question from python newcomers

--

___
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

2017-12-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Also see how the forkserver module does without it:
https://github.com/python/cpython/blob/master/Lib/multiprocessing/forkserver.py#L146

Reading Jean-Paul's messages in https://bugs.python.org/issue8407, I'm unclear 
what is required to take advantage of signalfd().  Jean-Paul says """In order 
to effectively use signalfd(), the signals in question must be blocked, 
though""".  The signalfd man page says:

"""Normally, the set of signals to  be  received  via the  file descriptor 
should be blocked using sigprocmask(2), to prevent the signals being handled 
according to their default dispositions""".

And it's not clear what is meant by that (what happens if you don't block those 
signals?). Also:

"""As a consequence of the read(2), the signals are consumed, so that they are 
no longer pending for the process (i.e., will not be caught by signal handlers, 
and cannot be accepted using sigwaitinfo(2))."""

But how about the converse?  i.e. can a signal be consumed first by a signal 
handler and the fd not written to at all?

Also see fork() semantics which might (or not) require special handling.

Also see https://bugs.python.org/issue31489 for an issue related to fork(), 
signals and fds.

--

___
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

2017-12-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

See also https://bugs.python.org/issue12304

--
nosy: +pitrou

___
Python tracker 

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



[issue32434] pathlib.WindowsPath.reslove(strict=False) returns absoulte path only if at least one component exists

2017-12-29 Thread Eryk Sun

Eryk Sun  added the comment:

resolve() has additional problems, which possibly could be addressed all at 
once because it's a small method and the problems are closely related.

For an empty path it returns os.getcwd(). I don't think this case is possible 
in the normal way a Path gets constructed. Anyway, returning the unresolved 
working directory is incorrect. Windows is not a POSIX OS. WinAPI 
[Set,Get]CurrentDirectory does not ensure the working directory is a resolved 
path. An empty path should be replaced with "." and processed normally.

It fails when access is denied. _getfinalpathname needs to open a handle, and 
CreateFile requires at least the right to read file attributes and synchronize. 
For example, resolve() fails for a path in another user's profile, which grants 
access only to the user, system, and administrators.

It doesn't keep the "?\\" extended-path prefix when the source path already 
has it. It should only strip the prefix if the source path doesn't have it. 
That said, the resolved path may actually require it (i.e. long paths, DOS 
device names, trailing spaces), so maybe it should  never be removed.

Its behavior is inconsistent for invalid paths. For example, if "C:/Temp" 
exists and "C:/Spam" does not, then resolving "C:/Temp/bad?" raises whereas 
"C:/Spam/bad?" does not. IMO, it's simpler if neither raises in non-strict 
mode, at least not in _WindowsFlavour.resolve. Malformed paths will slip 
through, but raising an exception in those cases should be the job of the 
constructor. 

It fails to handle device paths. For example, C:/Temp/nul" resolves to the 
"NUL" device if "C:/Temp" exists. In this case _getfinalpathname will typically 
fail, either due to an invalid function or an invalid parameter. These errors, 
along with the error for an invalid filename, get lumped into the CRT's default 
EINVAL error code.

Also, GetFinalPathNameByHandle was added in Vista, so _getfinalpathname is 
always available in 3.5+. There's no need to use it conditionally.

Here's a prototype that addresses these issues:

import nt
import os
import errno

def _is_extended(path):
return path.startswith('?\\')

def _extended_to_normal(path):
if _is_extended(path):
path = path[4:]
if path.startswith('UNC\\'):
path = '\\' + path[3:]
return path

def _getfinalpathname(path):
if not path:
path = '.'
elif _is_extended(path):
return nt._getfinalpathname(path)
return _extended_to_normal(nt._getfinalpathname(path))

def resolve(path, strict=False):
s = str(path)
if strict:
return _getfinalpathname(s)
# Non-strict mode resolves as much as possible while retaining
# tail components that cannot be resolved if they're missing,
# inaccessible, or invalid.
tail_parts = []
while True:
try:
s = _getfinalpathname(s)
break
except OSError as e:
if not (isinstance(e, (FileNotFoundError, PermissionError)) or
e.errno == errno.EINVAL):
raise
head, tail = os.path.split(s)
if head == s:
return path.absolute()
s = head
tail_parts.append(tail)
if tail_parts:
s = os.path.join(s, *reversed(tail_parts))
return s

--

___
Python tracker 

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



[issue32434] pathlib.WindowsPath.reslove(strict=False) returns absoulte path only if at least one component exists

2017-12-29 Thread Eryk Sun

Eryk Sun  added the comment:

If none of the components of a relative path exist, then splitting off the head 
returns an empty string in the second-to-last pass through the while loop. In 
the last pass, _getfinalpathname("") raises FileNotFoundError, and ultimately 
resolve() ends up returning `path`. To avoid this, the empty string needs to be 
replaced with a ".". Then the last pass can resolve the working directory.

--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware
stage:  -> needs patch
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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 29/12/2017 à 06:26, Neil Schemenauer a écrit :
> 
> I wonder if I should drop PR 4682.

My main criterion (apart from performance issues which don't seem to
exist) for choosing between the two PRs would be implementation
complexity.  I find Serhiy's PR pleasantly uncomplicated (it even
*simplifies* the code in frameobject.c).

Your PR seems to add more complexity, so I would be inclined to choose
Serhiy's PR.

--

___
Python tracker 

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