[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Han Shaowen

Han Shaowen  added the comment:

Hohoho, I found the full-version doc. This issue over. Thanks Tim, Ned and 
Brett. And sorry about something improper I said, I respect female Pythonista.

--

___
Python tracker 

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



[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Tim Peters

Tim Peters  added the comment:

docstrings give brief statements intended to jog your memory; they're not 
intended to be comprehensive docs.  Read the actual documentation and see 
whether you're still confused.  When you "assumed it is irrelevant to time 
zone", that was your _assumption_, which the actual docs would have clarified.

The whole story simply can't be told here without docs that make the 
distinction between "naive" and "aware" datetime objects, and the connection to 
what your platform's C mktime() function does about your local time zone.  The 
brief docstring is correct that a POSIX timestamp is returned (a count of 
seconds from the UTC epoch).  But how that relates to the datetime object 
requires reading the docs, not blind guessing ;-)

--

___
Python tracker 

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



[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Han Shaowen

Han Shaowen  added the comment:

Guys, what I said is the doc in help(datetime.timestamp) is 'Return POSIX 
timestamp as float.' So I assumed it is irrelevant to time zone, considering 
POSIX timestamp's definition. If it is then datetime.now and datetime.utcnow 
should return the same timestamp. But datetime.now().timestamp return a correct 
timestamp which I checked in the website https://www.unixtimestamp.com/ but 
datetime.utcnow().timestamp did not.

:)

--

___
Python tracker 

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



[issue33304] Syntax Error on leading 0 in integer tokens

2018-04-17 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

I've opened an issue to improve the error message: #33305

--

___
Python tracker 

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



[issue33305] Improve syntax error for numbers with leading zero

2018-04-17 Thread Steven D'Aprano

Change by Steven D'Aprano :


--
type: behavior -> enhancement

___
Python tracker 

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



[issue33305] Improve syntax error for numbers with leading zero

2018-04-17 Thread Steven D'Aprano

New submission from Steven D'Aprano :

The Python 2.x syntax for octal integers is a syntax error in 3.x, but the 
error message is very uninformative:

SyntaxError: invalid token


Can this be improved? Perhaps to something like:

invalid token, use 0o prefix for octal integers


(see also #33304)

--
messages: 315431
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: Improve syntax error for numbers with leading zero
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue33304] Syntax Error on leading 0 in integer tokens

2018-04-17 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

This is not a bug, it is intentional.

In Python 2, numbers with a leading zero are interpreted as octal, leading to 
surprising results:

py> 015
13

In Python 3, we use 0o15 to get octal, and 015 becomes a syntax error.

--
nosy: +steven.daprano
resolution:  -> not a bug
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



[issue33304] Syntax Error on leading 0 in integer tokens

2018-04-17 Thread jackb

New submission from jackb :

Entering 007 gives a syntax error. Should return 7.
00 correctly returns 0.
007. correctly returns 7.0.

--
components: Interpreter Core
messages: 315429
nosy: jackb
priority: normal
severity: normal
status: open
title: Syntax Error on leading 0 in integer tokens
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue33303] ElementTree Comment text isn't escaped

2018-04-17 Thread John Burnett

New submission from John Burnett :

The _serialize_xml function in ElementTree.py doesn't escape Comment.text 
values when writing output.  This means the following code:

import sys
import xml.etree.ElementTree
elem = xml.etree.ElementTree.Comment()
elem.text = 'hi --> bye'
tree = xml.etree.ElementTree.ElementTree(elem)
tree.write(sys.stdout)

...will output the following invalid xml:

 bye-->

In Python 3.7, changing the _serialize_xml function on line 903/904 from this:

if tag is Comment:
write("" % text)

...to this:

if tag is Comment:
write("" % _escape_cdata(text))

...writes something more expected:



--
components: XML
messages: 315428
nosy: eli.bendersky, johnburnett, scoder
priority: normal
severity: normal
status: open
title: ElementTree Comment text isn't escaped
type: behavior
versions: Python 2.7, 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



[issue28126] Py_MEMCPY: Use memcpy on Windows?

2018-04-17 Thread Andro Nuxx

Andro Nuxx  added the comment:

Py_MEMCPY() has a special case for small blocks on Windows to work around an 
ancient performance issue in MSVC. Can we safely assume that recent MSVC 
properly optimize memcpy()? See #28055

/* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks
 * are often very short.  While most platforms have highly optimized code for
 * large transfers, the setup costs for memcpy are often quite high.  MEMCPY
 * solves this by doing short copies "in line".
 */

#if defined(_MSC_VER)
#define Py_MEMCPY(target, source, length) do {  \
size_t i_, n_ = (length);   \
char *t_ = (void*) (target);\
const char *s_ = (void*) (source);  \
if (n_ >= 16)   \
memcpy(t_, s_, n_); \
else\
for (i_ = 0; i_ < n_; i_++) \
t_[i_] = s_[i_];\
} while (0)
#else
#define Py_MEMCPY memcpy
#endif

--
nosy: +gitinit...@gmail.com

___
Python tracker 

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



[issue33297] Mention Pillow package on tkinter.rst to work with more image formats

2018-04-17 Thread Terry J. Reedy

Change by Terry J. Reedy :


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



[issue11594] 2to3 does not preserve line endings

2018-04-17 Thread miss-islington

miss-islington  added the comment:


New changeset 3b3be1fe10f6c15e57360cac9d9dbc660666e655 by Miss Islington (bot) 
in branch '3.7':
bpo-11594: Ensure line-endings are respected when using 2to3 (GH-6483)
https://github.com/python/cpython/commit/3b3be1fe10f6c15e57360cac9d9dbc660666e655


--
nosy: +miss-islington

___
Python tracker 

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



[issue32108] configparser bug: section is emptied if you assign a section to itself

2018-04-17 Thread Łukasz Langa

Łukasz Langa  added the comment:

I agree, the fix needs to be changed. What we probably want is to discover this 
kind of assignment and special-case *that*.

--
versions: +Python 3.6, Python 3.7, Python 3.8 -Python 3.5

___
Python tracker 

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



[issue33302] The search for pyvenv.cfg doesn't match PEP 405

2018-04-17 Thread Matthew Woodcraft

New submission from Matthew Woodcraft :

PEP 405 says that the pyvenv.cfg file is found as follows:

« a pyvenv.cfg file is found either adjacent to the Python executable or one 
directory above it (if the executable is a symlink, it is not dereferenced), »

But in cpython if the executable is a symlink, it _is_ dereferenced before 
searching for pyvenv.cfg .

I've checked this behaviour with Python 3.5, 3.6, and today's 3.7 tip.

Looking in 3.7's getpath.c, calculate_path_impl() calls, in order:

   calculate_program_full_path()
   calculate_argv0_path()
   calculate_read_pyenv()

It looks like the symlink resolution happens near the end of 
calculate_argv0_path().


I think this means that the 'home=' line in pyvenv.cfg files generated by the 
'venv' module is irrelevant (and seems likely to confuse anyone who might try 
to construct a Python environment by imitating a built venv).

--
components: Interpreter Core
messages: 315424
nosy: mattheww
priority: normal
severity: normal
status: open
title: The search for pyvenv.cfg doesn't match PEP 405
type: behavior
versions: 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



[issue11594] 2to3 does not preserve line endings

2018-04-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6208

___
Python tracker 

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



[issue33301] Add __contains__ to pathlib

2018-04-17 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue11594] 2to3 does not preserve line endings

2018-04-17 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c127a86e1862df88ec6f9d15b79c627fc616766e by Łukasz Langa (Aaron 
Ang) in branch 'master':
bpo-11594: Ensure line-endings are respected when using 2to3 (GH-6483)
https://github.com/python/cpython/commit/c127a86e1862df88ec6f9d15b79c627fc616766e


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue33301] Add __contains__ to pathlib

2018-04-17 Thread Alok Singh

New submission from Alok Singh :

I was thinking today that it would be natural for paths to support __contains__ 
since then you could write statements like `if file in dir` or `if subdir in 
dir` cleanly.

The library plumbum appears to already have this, but I think it could be 
useful in the standard library:

https://plumbum.readthedocs.io/en/latest/_modules/plumbum/path/base.html#Path.__contains__

--
components: Library (Lib)
messages: 315422
nosy: Alok Singh
priority: normal
severity: normal
status: open
title: Add __contains__ to pathlib
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



[issue32533] SSLSocket read/write thread-unsafety

2018-04-17 Thread James Lu

Change by James Lu :


--
nosy: +tacocat

___
Python tracker 

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



[issue33090] race condition between send and recv in _ssl with non-zero timeout

2018-04-17 Thread James Lu

Change by James Lu :


--
nosy: +tacocat

___
Python tracker 

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



[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Tim Peters

Tim Peters  added the comment:

Ned, I think this one is more the case that the OP didn't read the docs ;-)

That said, there's a level of complexity here that seemingly can't be reduced:  
the distinctions between the `datetime` and `time` modules' views of the world, 
and between `datetime`'s notions of `aware` and `naive` datetime objects.  
Those are general distinctions that apply all over the place, not just in a 
method or two's docs.

Given that those are understood, the OP's results "are obvious".  But it takes 
some work for users to get to that point, and best I can tell the current docs 
have been successful at helping users get there - but they do have to do the 
work of reading them thoughtfully.

--

___
Python tracker 

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



[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Ned Deily

Ned Deily  added the comment:

Tim, do you think the docs should be changed and, if so, which sections?  If 
you dictate, I'll type!

--

___
Python tracker 

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



[issue33234] Improve list() pre-sizing for inputs with known lengths

2018-04-17 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Microbenchmarked with @vstinner's perf module:

python -m perf timeit "list([0]*10)" -o new.json

checkout master and build

python -m perf timeit "list([0]*10)" -o old.json
python -m perf compare_to new.json old.json
Mean +- std dev: [new] 241 ns +- 3 ns -> [old] 243 ns +- 18 ns: 1.01x slower 
(+1%)
Not significant!

--
nosy: +pablogsal

___
Python tracker 

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



[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Tim Peters

Tim Peters  added the comment:

I agree this isn't a bug (and it was right to close it).  I expect the OP is 
confused about what the `.timestamp()` method does, though.  This note in the 
docs directly address what happens in their problematic 
`datetime.utcnow().timestamp()` case:

"""
Note There is no method to obtain the POSIX timestamp directly from a naive 
datetime instance representing UTC time. If your application uses this 
convention and your system timezone is not set to UTC, you can obtain the POSIX 
timestamp by supplying tzinfo=timezone.utc:

timestamp = dt.replace(tzinfo=timezone.utc).timestamp()

or by calculating the timestamp directly:

timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)
"""

--
nosy: +tim.peters

___
Python tracker 

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



[issue33291] issue in the default setup.py which comes with the Python 3.6.5 installer

2018-04-17 Thread Brett Cannon

Brett Cannon  added the comment:

We don't having to do with the stegano project. It looks like they specified 
the wrong encoding in their setup.py. (This also isn't the issue tracker for 
pip, but I don't think they have the bug.)

--
nosy: +brett.cannon
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



[issue33300] Bad usage example in id() DocString

2018-04-17 Thread Martin Panter

Martin Panter  added the comment:

It is supposed to be a function signature, similar to the syntax when you 
define your own function, rather than a usage example of calling the function.

In this case, the slash notation is described by PEP 457. It is supposed to 
indicate that “obj” is a positional-only parameter, and not a keyword 
parameter. If that is what you think is incorrect, perhaps you can suggest a 
place to explain the notation in Issue 21314.

--
nosy: +martin.panter
superseder:  -> Document '/' in signatures

___
Python tracker 

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



[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Ned Deily

Ned Deily  added the comment:

I am not sure I understand what behavior you are expecting.  But datetime.now() 
is documented as returning "the current local date and time" (assuming no tx= 
argument is provided) while datetime.utcnow() returns "the current UTC date and 
time".  So I would expect the two to provide a similar value only if your 
system/process local time zone is set to UTC.  I'm guessing the time zone in 
effect when your examples were run was 8 hours ahead of UTC:

>>> (1523942165.202865 - 1523913372.362377) / (60*60)
7.998011246654722

https://docs.python.org/3/library/datetime.html

--
nosy: +ned.deily -belopolsky, brett.cannon
resolution:  -> not a bug
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



[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Brett Cannon

Brett Cannon  added the comment:

And we do have women on the team, so please minimize the "fellas" comments.

--

___
Python tracker 

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



[issue33293] Using datetime.datetime.utcnow().timestamp() in Python3.6.0 can't get correct UTC timestamp.

2018-04-17 Thread Brett Cannon

Brett Cannon  added the comment:

Are you seeing the same issue on Python 3.6.5?

--
nosy: +belopolsky, brett.cannon

___
Python tracker 

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



[issue33234] Improve list() pre-sizing for inputs with known lengths

2018-04-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Calling PyObject_LengthHint() adds an overhead. It is significant for short 
sequences. I work on a patch that reduces it. PR 6493 adds the second call of 
PyObject_LengthHint() and increases the overhead.

As for this issue, in-place repeat overallocates too.

>>> a = [0]; a *= 10; getsizeof(a)
200

I think it would be better to make it not preallocating.

And maybe it would be worth to avoid overallocating if newsize > allocated + 
allocated/8 or something like.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19143] Finding the Windows version getting messier (detect windows 8.1?)

2018-04-17 Thread Steve Dower

Steve Dower  added the comment:

The attached files should work on Python 3.4. Feel free to use them.

--

___
Python tracker 

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



[issue33300] Bad usage example in id() DocString

2018-04-17 Thread Glen Neff

New submission from Glen Neff :

The DocString for id() in 3.5.x & 3.6.x seems to have an incorrect usage 
example, specifically ``id(obj, /)``.

This is present in 3.5.x & 3.6.x.  It does not appear to be present in 2.7.x or 
3.4.x.:

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> help(id)
Help on built-in function id in module builtins:

id(obj, /)
Return the identity of an object.

This is guaranteed to be unique among simultaneously existing objects.
(CPython uses the object's memory address.)

>>>

--
assignee: docs@python
components: Documentation
messages: 315410
nosy: docs@python, gneff
priority: normal
severity: normal
status: open
title: Bad usage example in id() DocString
versions: 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



[issue33262] Deprecate shlex.split(None) to read from stdin.

2018-04-17 Thread Zackery Spytz

Change by Zackery Spytz :


--
components: +Library (Lib)
nosy: +ZackerySpytz

___
Python tracker 

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



[issue33262] Deprecate shlex.split(None) to read from stdin.

2018-04-17 Thread Zackery Spytz

Change by Zackery Spytz :


--
keywords: +patch
pull_requests: +6207
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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-17 Thread INADA Naoki

Change by INADA Naoki :


--
resolution:  -> fixed

___
Python tracker 

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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-17 Thread INADA Naoki

Change by INADA Naoki :


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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-17 Thread miss-islington

miss-islington  added the comment:


New changeset 902bb62d5af21526b68892a1032c63aa86ded247 by Miss Islington (bot) 
in branch '3.7':
bpo-33205: dict: Change GROWTH_RATE to `used*3` (GH-6350)
https://github.com/python/cpython/commit/902bb62d5af21526b68892a1032c63aa86ded247


--
nosy: +miss-islington

___
Python tracker 

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



[issue33298] Wrap only constants with _PyCode_ConstantKey() in the compiler.

2018-04-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

See issue33299 for the first option.

--

___
Python tracker 

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



[issue33299] Return an object itself for some types in _PyCode_ConstantKey()

2018-04-17 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue33299] Return an object itself for some types in _PyCode_ConstantKey()

2018-04-17 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +vstinner

___
Python tracker 

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



[issue33299] Return an object itself for some types in _PyCode_ConstantKey()

2018-04-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

_PyCode_ConstantKey() wraps a constant into a tuple that contains other items 
besides the wrapped object. This makes booleans different from 0 and 1, makes 
numbers of different type different (1, 1.0 and 1.0+0j), makes floating point 
zeros with different signs different (0.0 and -0.0), and avoids a ByteWarning 
from comparing strings and bytes.

But for some types objects are always different from objects of other types and 
from tuples. _PyCode_ConstantKey() can be made faster and using less memory if 
return the object of these types unwrapped.

--
components: Interpreter Core
messages: 315407
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Return an object itself for some types in _PyCode_ConstantKey()
type: performance
versions: Python 3.8

___
Python tracker 

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



[issue33298] Wrap only constants with _PyCode_ConstantKey() in the compiler.

2018-04-17 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +vstinner

___
Python tracker 

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



[issue33290] Python.org macOS pkg installs pip3 as pip

2018-04-17 Thread Gilbert Wilson

Gilbert Wilson  added the comment:

Well what do you know, it does indeed look like a pip3 upgrade issue! I'll 
wander over to the pip issue tracker and file a bug/upvote over there. Thanks!


gilw-mbp:bin gilw$ ls -al pip*
-rwxrwxr-x  1 root  admin  253 Apr 17 09:21 pip3
-rwxrwxr-x  1 root  admin  253 Apr 17 09:21 pip3.6

gilw-mbp:bin gilw$ pip3 install --upgrade pip
Collecting pip
  Downloading 
https://files.pythonhosted.org/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl
 (1.3MB)
100% || 1.3MB 1.0MB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
Uninstalling pip-9.0.3:
  Successfully uninstalled pip-9.0.3
Successfully installed pip-10.0.0
gilw-mbp:bin gilw$ ls -al pip*
-rwxr-xr-x  1 gilw  admin  263 Apr 17 09:23 pip
-rwxr-xr-x  1 gilw  admin  263 Apr 17 09:23 pip3
-rwxr-xr-x  1 gilw  admin  263 Apr 17 09:23 pip3.6

--

___
Python tracker 

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



[issue33298] Wrap only constants with _PyCode_ConstantKey() in the compiler.

2018-04-17 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue33298] Wrap only constants with _PyCode_ConstantKey() in the compiler.

2018-04-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Currently every constant is wrapped with _PyCode_ConstantKey() in the compiler. 
This is necessary for distinguishing numbers 1, 1.0 and 1.0+0j, 0.0 and -0.0, 
and avoiding warnings from comparing string and bytes constants.

But the change that introduced using _PyCode_ConstantKey() for constants (in 
issue25843) also caused to wrapping names with _PyCode_ConstantKey(). This is 
superfluous because all names are strings. This just consumes memory for 
2-tuples for every name and spends CPU time for creating these tuples for every 
name.

There are two ways of getting rid of this overhead.

1. Make _PyCode_ConstantKey() returning just a string itself for string 
argument. Strings are never equal to tuples. This requires minimal changes.

2. Use different helpers for adding constants and names, and use 
_PyCode_ConstantKey() only for names. This will clean up the code for names, 
but needs adding few special functions and macros.

I'm going to apply both solution. The first one will add a benefit for string 
constants (and other common types), the second one will help moving the folding 
tuples of constants from peephole.c to compile.c and generalizing it for lists, 
sets and dicts of constants, constant default values, constant arguments, etc.

The following PR implements the second option.

--
assignee: serhiy.storchaka
components: Interpreter Core
messages: 315405
nosy: benjamin.peterson, brett.cannon, ncoghlan, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Wrap only constants with _PyCode_ConstantKey() in the compiler.
type: performance
versions: Python 3.8

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread Berker Peksag

Berker Peksag  added the comment:

I initially thought about using pythontest.net but I don't think it's possible 
to remove the Connection header at the nginx level: 
https://github.com/python/psf-salt/blob/master/salt/pythontest/config/nginx.pythontest.conf.jinja

I think our only option is to create a local server for the test. I'm not sure 
it's an important enough use case, though.

--
nosy: +berker.peksag, orsenthil
type:  -> behavior

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread Ned Deily

Ned Deily  added the comment:

Thanks!  I force-merged the skips of the test so that Travis CI and buildbots 
were not failing.  I'll leave the issue open so we can decide what to do about 
the test long term.

--

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread Ned Deily

Ned Deily  added the comment:


New changeset f1547d110ff195291e29ba5c29617912d12ecbec by Ned Deily (Miss 
Islington (bot)) in branch '3.6':
bpo-33295: Skip test using missing external site (GH-6504) (GH-6511)
https://github.com/python/cpython/commit/f1547d110ff195291e29ba5c29617912d12ecbec


--

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread Ned Deily

Ned Deily  added the comment:


New changeset afc768d69879d6b95c59a0a5e92ea4c6061f3841 by Ned Deily (Miss 
Islington (bot)) in branch '2.7':
bpo-33295: Skip test using missing external site (GH-6504) (GH-6510)
https://github.com/python/cpython/commit/afc768d69879d6b95c59a0a5e92ea4c6061f3841


--

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6204

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread Ned Deily

Ned Deily  added the comment:


New changeset f7379ddf1c315fe18734cca943aff5b437baf849 by Ned Deily (Miss 
Islington (bot)) in branch '3.7':
bpo-33295: Skip test using missing external site (GH-6504) (GH-6509)
https://github.com/python/cpython/commit/f7379ddf1c315fe18734cca943aff5b437baf849


--

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6203

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6202

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread Ned Deily

Ned Deily  added the comment:


New changeset 36d56ea826caffbeac0fc0c6d90248b80516e33c by Ned Deily (INADA 
Naoki) in branch 'master':
bpo-33295: Skip test using missing external site (GH-6504)
https://github.com/python/cpython/commit/36d56ea826caffbeac0fc0c6d90248b80516e33c


--
nosy: +ned.deily

___
Python tracker 

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



[issue33144] random._randbelow optimization

2018-04-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Possibly, the switch from type checks to identity checks could be considered a 
bugfix that could be backported.  I've always had a lingering worry about that 
part of the code.

--

___
Python tracker 

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



[issue33144] random._randbelow optimization

2018-04-17 Thread Raymond Hettinger

Raymond Hettinger  added the comment:


New changeset ba3a87aca37cec5b1ee32cf68f4a254fa0bb2bec by Raymond Hettinger 
(Wolfgang Maier) in branch 'master':
bpo-33144: random.Random and subclasses: split _randbelow implementation 
(GH-6291)
https://github.com/python/cpython/commit/ba3a87aca37cec5b1ee32cf68f4a254fa0bb2bec


--

___
Python tracker 

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



[issue19143] Finding the Windows version getting messier (detect windows 8.1?)

2018-04-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Does the problem still exist on Python 3.6? Python 3.4 is now in security fixes 
only mode. The only solution for you may be upgrading to Python 3.6.

--

___
Python tracker 

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



[issue33292] Fix secrets.randbelow docstring

2018-04-17 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Possibly you may not be familiar with interval notation?

https://www.mathsisfun.com/sets/intervals.html

Since this is Python and not maths, maybe we should rethink the wording.

--

___
Python tracker 

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



[issue19143] Finding the Windows version getting messier (detect windows 8.1?)

2018-04-17 Thread Mark Lawrence

Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue19143] Finding the Windows version getting messier (detect windows 8.1?)

2018-04-17 Thread Mahmud Al Hasan

Mahmud Al Hasan  added the comment:

The problem still exists on python 3.4 and I need to use this version.
Any solution?

--
nosy: +rauaha
versions:  -Python 2.7, 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



[issue33297] Mention Pillow package on tkinter.rst to work with more image formats

2018-04-17 Thread Andrés Delfino

Change by Andrés Delfino :


--
type:  -> enhancement

___
Python tracker 

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



[issue33297] Mention Pillow package on tkinter.rst to work with more image formats

2018-04-17 Thread Andrés Delfino

Change by Andrés Delfino :


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

___
Python tracker 

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



[issue33297] Mention Pillow package on tkinter.rst to work with more image formats

2018-04-17 Thread Andrés Delfino

New submission from Andrés Delfino :

Given that the default list of supported formats is quite limited, IMHO we 
should point to Pillow, or any other package that provides support for more 
formats.

--
assignee: docs@python
components: Documentation
messages: 315393
nosy: adelfino, docs@python
priority: normal
severity: normal
status: open
title: Mention Pillow package on tkinter.rst to work with more image formats
versions: Python 3.8

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread INADA Naoki

Change by INADA Naoki :


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

___
Python tracker 

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



[issue32232] building extensions as builtins is broken in 3.7

2018-04-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

Ah, oops - I commented before fully catching up on everything else, and now I 
see that Xavier already made exactly that point just above.

I'll go review the PR now :)

--

___
Python tracker 

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



[issue32232] building extensions as builtins is broken in 3.7

2018-04-17 Thread Nick Coghlan

Nick Coghlan  added the comment:

Even when statically linked, extension modules should *NOT* be getting built 
with `-DPy_BUILD_CORE`. That preprocessor definition is for CPython core core 
only, and we moved the headers to help make that 100% crystal clear.

--

___
Python tracker 

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



[issue33251] ConfigParser.items returns items present in vars

2018-04-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What *actually* was changed in 3.2?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33189] pygettext doesn't work with f-strings

2018-04-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

If there are no objections I'm going to merge PR 6364 in 24 hours.

--
assignee:  -> serhiy.storchaka
nosy: +lemburg

___
Python tracker 

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



[issue33283] Mention PNG as a supported image format by Tcl/Tk

2018-04-17 Thread miss-islington

miss-islington  added the comment:


New changeset f44ce356a6ccd6c8e80ac5c4b29adb13db5c117a by Miss Islington (bot) 
in branch '3.6':
bpo-33283: Mention PNG as a supported format by Tcl/Tk. (GH-6479)
https://github.com/python/cpython/commit/f44ce356a6ccd6c8e80ac5c4b29adb13db5c117a


--
nosy: +miss-islington

___
Python tracker 

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



[issue33292] Fix secrets.randbelow docstring

2018-04-17 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't think that intervals [0, n-1] or (-1, n) would look better than [0, n).

--
resolution:  -> not a bug
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



[issue33296] datetime.datetime.utcfromtimestamp call decimal causes precision loss

2018-04-17 Thread Shlomo Anglister

Shlomo Anglister  added the comment:

The test code demonstrates that fromutctimestamp(1523510588.436252000) != 
fromutctimestamp(Decimal(1523510588.436252000))

This is related to issues: 22627 and 23607
but not a duplicate

--

___
Python tracker 

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



[issue15443] datetime module has no support for nanoseconds

2018-04-17 Thread Shlomo Anglister

Change by Shlomo Anglister :


--
nosy: +anglister

___
Python tracker 

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



[issue33296] datetime.datetime.utcfromtimestamp call decimal causes precision loss

2018-04-17 Thread Shlomo Anglister

New submission from Shlomo Anglister :

Output for python2.7.11

2018-04-12-05:23:08.436252
2018-04-12-05:23:08.436252

Output for python3.4 and python3.6

2018-04-12-05:23:08.436252
2018-04-12-05:23:08.00

--
components: Library (Lib)
files: timestamp_decimal_test.py
messages: 315385
nosy: anglister
priority: normal
severity: normal
status: open
title: datetime.datetime.utcfromtimestamp call decimal causes precision loss
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: https://bugs.python.org/file47538/timestamp_decimal_test.py

___
Python tracker 

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



[issue33295] ERROR: test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests)

2018-04-17 Thread INADA Naoki

New submission from INADA Naoki :

https://github.com/python/cpython/blob/5fbc511f56688654a05b9eba23d140318bb9b2d5/Lib/test/test_urllib2net.py#L180-L198

This test uses http://www.imdb.com/, but it is gone.
So This test start failing.

Is there any good URL for this test case?
May I skip this test for now?

--
components: Tests
messages: 315384
nosy: inada.naoki
priority: critical
severity: normal
status: open
title: ERROR: test_sites_no_connection_close 
(test.test_urllib2net.OtherNetworkTests)
versions: Python 2.7, Python 3.6, 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



[issue33292] Fix secrets.randbelow docstring

2018-04-17 Thread Vex Woo

Vex Woo  added the comment:

Please use () or []

--

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module

2018-04-17 Thread Sylvain Marie

Sylvain Marie  added the comment:

Mark
I get your point.

Mine is just to have a common abstraction between python's primitive bool and 
numpy bool (and possibly other future alternate booleans) for consistency with 
`numbers` and to be used in common type hints (PEP484). 

If I get you correctly, then the minimal `Boolean` ABC would only need to 
contain the `__bool__` method, without the bitwise operations. That's perfectly 
fine, as long as it correctly describes the minimal boolean logic (truth value 
for `if`/..., and `and`/`or`/`not`) and is compliant both with python and numpy 
bool.

A separate ABC for bitwise operations is then indeed a good idea to open in a 
separate thread. Finding a good name will be tough here though... 
`BitwiseOperable` ? `BitsContainer` ? ...  :)
Regards

-Sylvain

--

___
Python tracker 

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



[issue33294] Support complex expressions for py-print command.

2018-04-17 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue33294] Support complex expressions for py-print command.

2018-04-17 Thread Martin Liška

New submission from Martin Liška :

The patch is based on a blog post: 
http://kouk.surukle.me/2014/09/25/debugging-python-objects-and-fields-with-gdb/.
Adding him: @kouk

Purpose of the pull request is to support more complex expressions for py-print 
command.
Small example:

(gdb) py-print self
local 'self' = 

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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-17 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6198

___
Python tracker 

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



[issue33205] GROWTH_RATE prevents dict shrinking

2018-04-17 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 5fbc511f56688654a05b9eba23d140318bb9b2d5 by INADA Naoki in branch 
'master':
bpo-33205: dict: Change GROWTH_RATE to `used*3` (GH-6350)
https://github.com/python/cpython/commit/5fbc511f56688654a05b9eba23d140318bb9b2d5


--

___
Python tracker 

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