[issue34831] Asyncio Tutorial

2018-10-06 Thread Caleb Hattingh


Caleb Hattingh  added the comment:

A CLI client is a necessary step along the way anyway, so that sounds good by 
me.

You suggested:

> I'd organize the tutorial in a dedicated directory like 
> "Doc/library/asyncio-tutorial/" 

I had a look at the source tree, there is an existing "howto" directory; do you 
still prefer your suggestion of using "Doc/library/" over something like 
"Doc/howto/asyncio.rst"?

--

___
Python tracker 

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



[issue34918] Python 3 tkinter measurement problem

2018-10-06 Thread Adrian Keister


New submission from Adrian Keister :

tkinter.Tk().winfo_screenmmwidth() and tkinter.Tk().winfo_screenmmheight() give 
manifestly incorrect values in Windows. This does not appear to be an issue in 
Linux. I have not tested a Mac. The values reported in Windows are too large by 
as much as 58%. Searching online seems to indicate that the issue is some 
applications in Windows are "dpi aware"; unfortunately, none of the so-called 
work-arounds I've found actually fix the problem. The 
tkinter.Tk().winfo_screenwidth() and tkinter.Tk().winfo_screenheight() 
functions, reporting their results in pixels, appear to be correct. A MWE is 
simply

import tkinter
tkinter.Tk().winfo_screenmmwidth()

This reports a 508 mm on my 15.6" screen, when the true value is closer to 343 
mm. This is a 48% error, and hence an unusable result. 

Thank you for your time!

--
components: Tkinter
messages: 327265
nosy: Ackbach
priority: normal
severity: normal
status: open
title: Python 3 tkinter measurement problem
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



[issue34334] QueueHandler logs exc_info twice

2018-10-06 Thread Ned Deily


Ned Deily  added the comment:


New changeset 1a2189353f744f79a43511707c090c3807a4978e by Ned Deily (Miss 
Islington (bot)) in branch '3.7':
bpo-34334: Don't log traceback twice in QueueHandler (GH-9537) (GH-9581)
https://github.com/python/cpython/commit/1a2189353f744f79a43511707c090c3807a4978e


--
nosy: +ned.deily

___
Python tracker 

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



[issue34334] QueueHandler logs exc_info twice

2018-10-06 Thread Ned Deily


Change by Ned Deily :


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



[issue34806] distutils tests fail with recent 3.7 branch

2018-10-06 Thread Ned Deily


Ned Deily  added the comment:

@doko, Is this still reproducible with either 3.7.1rc1 or current 3.7 head? 
Otherwise, let's consider closing it.

--
nosy: +ned.deily

___
Python tracker 

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



[issue34917] add time decorator to timeit.py

2018-10-06 Thread Ezio Melotti


Ezio Melotti  added the comment:

Thanks for the decorator, however this should probably be discussed on 
python-ideas first to decide if a decorator should be added in the first place. 
 If the idea is accepted, the exact implementation should be discussed and 
defined, and finally a pull request should be submitted.
The decorator you submitted can't be accepted as it is, so for the time being, 
I'm going to reject it and close the issue.

--
nosy: +ezio.melotti
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue34917] add time decorator to timeit.py

2018-10-06 Thread AmjadHD


New submission from AmjadHD :

I made this simple time decorator, it's not perfect but it does make python 
more pythonic :) :
it can be used as a decorator:
```
@timef
def fun_to_time(a, b):
...
```
or as a function call
`timef(print)("Hello world!")`
just a simple decorator no need for
`timeit.timeit("fun_to_time(a, b)", setup="from __main__ import a, b", 
number=1)`
it's also customizable as you can control number of repetitions, garbage 
collection, unit ...
and it produces a formatted output such as:
`fun_to_time: 24.1056 ms`.
It is somewhat badly written so waiting for your word people of wisdom :).
I think python needs this in the standard library as the current way is 
(sometimes) tedious.

--
components: Library (Lib)
files: timeit.py
messages: 327261
nosy: amjad ben hedhili
priority: normal
severity: normal
status: open
title: add time decorator to timeit.py
type: enhancement
versions: Python 3.7
Added file: https://bugs.python.org/file47855/timeit.py

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-10-06 Thread Tim Peters


Tim Peters  added the comment:

Thinking about the way xxHash works prompted me to try this initialization 
change:

x = 0x345678UL + (Py_uhash_t)len; // adding in the length is new

That was a pure win in my tests, slashing the number of collisions in the new 
tuple test, 32-bit build, from 51 to 17.  In the 64-bit build, cut from 11 to 
10, but when looking at the high 32 hash bits instead from 27 to 15.  There 
were also small improvements in other 32-bit build collision stats.

Full-blown xxHash (& SeaHash, and murmurhash, and ...) also fold in the length, 
but not inside their core loops.  It's useful info!

But they fold it in _after_ their core loops, not before.  They're apparently 
worried about this:  if their internal state ever reaches 0, that's a fixed 
point so long as all remaining incoming data is zeroes (in Python, e.g., 
picture adding one or more trailing integer or float zeroes or ..., which hash 
to 0).  Folding in the length at the end snaps it slightly out of zeroland.

I don't really care about that.  Folding in the length at the start quickly 
leads to large differences across iterations for tuples of different lengths 
(thanks to repeated mulitiplication and "propagate right" steps), which is 
especially helpful in things like the nested tuple tests where there's almost 
as much variation in tuple lengths as there is in the few little integers 
bottom-level tuples contain.

--

___
Python tracker 

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



[issue30588] Missing documentation for codecs.escape_decode

2018-10-06 Thread Paul Hoffman


Paul Hoffman  added the comment:

Bumping this thread a bit. It appears that this "internal" function is being 
talked about out in the real world. I came across it in a recent blog post, saw 
that it wasn't in the official documentation, and went looking here.

I propose that it be documented even if it feels like a tad of a kludge.

--
nosy: +paulehoffman

___
Python tracker 

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



[issue32788] Better error handling in sqlite3

2018-10-06 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


--
nosy: +sir-sigurd

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-10-06 Thread Tim Peters


Tim Peters  added the comment:

As a sanity check, I tried the 32-bit version of MurmurHash2 (version 3 doesn't 
have a 32-bit version).  All of my Python tests had collisions, and while the 
new tuple test dropped to 15, product([0.5, 0.25], repeat=20) skyrocketed from 
141 (32-bit xxHash) to 3848.

I could live with that too, but xxHash does better overall on our tiny tests, 
and requires less code and fewer cycles.

Here's what I used:

static Py_hash_t
tuplehash(PyTupleObject *v)
{
const Py_uhash_t m = 0x5bd1e995;
const int r = 24;
Py_uhash_t x, t;  /* Unsigned for defined overflow behavior. */
Py_hash_t y;
Py_ssize_t len = Py_SIZE(v);
PyObject **p;
x = 0x345678UL ^ (Py_uhash_t)len;
p = v->ob_item;
while (--len >= 0) {
y = PyObject_Hash(*p++);
if (y == -1)
return -1;
Py_uhash_t t = (Py_uhash_t)y;
t *= m;
t ^= t >> r;
t *= m;
x *= m;
x ^= t;
}
x ^= x >> 13;
x *= m;
x ^= x >> 15;
if (x == (Py_uhash_t)-1)
x = -2;
return x;
}

--

___
Python tracker 

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



[issue34893] Add 2to3 fixer to change send and recv methods of socket object.

2018-10-06 Thread Pranav Devarakonda


Pranav Devarakonda  added the comment:

Thanks for pointing out these cases. I kept in mind the Python 2 documentation 
which says socket.send method expects a string and hence made that fixer. I 
have tweaked that fixer to handle the pointed cases and a few additional ones 
too. Please find attached the updated fixer. To summarize, the following send() 
cases would not be changed,

data = "Data"
s.send(str.encode(data))
s.send(data.encode('utf-8))
s.send(bytes(data, 'utf-8'))
s.send(struct.pack('!I', x))

Similary, the following recv() cases would not be changed, 

data = s.recv(1024).decode('utf-8')
q, w, e = struct.unpack('!IHQ', s.recv(4))

The remaining generic cases will be handled as expected. I know we cannot 
handle cases where the data has already been converted to bytes(since there is 
no way to find the 'type' of the object here) and then sent as an argument to 
socket.send(). But if we have to go by the documentation, then this is probably 
the right thing to do.

--
Added file: https://bugs.python.org/file47854/fix_socket_send_recv_updated.py

___
Python tracker 

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



[issue33729] Hashlib/blake2* missing 'data' keyword argument

2018-10-06 Thread Christian Heimes


Christian Heimes  added the comment:

Ned, I'm currently travelling until next weekend. The PR is rather large and I 
don't have any means or time to review it properly. Perhaps Gregory or Dmitry 
Chestnykh (original author of pyblake2) are able to assist.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue34824] _ssl.c: Possible null pointer dereference

2018-10-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9131

___
Python tracker 

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



[issue34824] _ssl.c: Possible null pointer dereference

2018-10-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9132

___
Python tracker 

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



[issue34824] _ssl.c: Possible null pointer dereference

2018-10-06 Thread miss-islington


miss-islington  added the comment:


New changeset 365ad2ead5bbaf7a3b18648ffa36e819559d3f75 by Miss Islington (bot) 
(Zackery Spytz) in branch 'master':
bpo-34824: Fix a possible NULL pointer dereference in _ssl.c (GH-9606)
https://github.com/python/cpython/commit/365ad2ead5bbaf7a3b18648ffa36e819559d3f75


--
nosy: +miss-islington

___
Python tracker 

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



[issue34909] StrEnum subclasses cannot be created

2018-10-06 Thread Ethan Furman

Ethan Furman  added the comment:

Stéphane, thanks for the tip about bisect!

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



[issue34916] include sqlite-3.25+ (with window functions)

2018-10-06 Thread Big Stone


New submission from Big Stone :

sqlite-3.25 now includes window functions, something very important in modern 
SQL.

 https://www.sqlite.org/windowfunctions.html

Could it be included in next Python maintenance release ?

--
messages: 327253
nosy: Big Stone
priority: normal
severity: normal
status: open
title: include sqlite-3.25+ (with window functions)

___
Python tracker 

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



[issue33436] Add an interactive shell for Sqlite3

2018-10-06 Thread Big Stone


Big Stone  added the comment:

as a graphical sqlite browser, you have sqlite_bro that may give you 
inspiration. It's about one single file.

--
nosy: +Big Stone

___
Python tracker 

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



[issue32995] Add a glossary entry for context variables

2018-10-06 Thread Vinodhini


Change by Vinodhini :


--
pull_requests: +9130

___
Python tracker 

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



[issue34769] _asyncgen_finalizer_hook running in wrong thread

2018-10-06 Thread twisteroid ambassador

twisteroid ambassador  added the comment:

I’m now convinced that the bug we’re fixing and the original bug with debug 
mode off are two separate bugs. With the fix in place and debug mode off, I’m 
still seeing the original buggy behavior. Bummer.


In my actual program, I have an async generator that spawns two tasks. In the 
finally clause I cancel and wait for them, then check and log any exceptions. 
The program ran on Python 3.7. The symptom of the original bug is occasional 
“Task exception was never retrieved” log entries about one of the spawned 
tasks. After I patched 3.7 with the fix, the symptom remains, so the fix does 
not actually fix the original bug.

Running the same program on master, there are additional error and warning 
messages about open stream objects being garbage collected, unclosed sockets, 
etc. Are these logging messages new to 3.8? If not, perhaps 3.8 introduced 
additional bugs?

--

___
Python tracker 

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



[issue32995] Add a glossary entry for context variables

2018-10-06 Thread Vinodhini


Change by Vinodhini :


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

___
Python tracker 

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



[issue34725] Py_GetProgramFullPath() odd behaviour in Windows

2018-10-06 Thread Nick Coghlan


Nick Coghlan  added the comment:

Directly addressing the topic of the bug:

Py_SetProgramName() should be a relative or absolute path that can be used to 
set sys.executable and other values appropriately. This is used in 
Programs/_testembed.c for example.

I didn't know it didn't work the same way on Windows as it does on other 
platforms, and I have no idea why it's different there. (The divergence between 
the Windows and *nix implementations of getpath predates my own involvement in 
startup sequence modifications, and I've never even read the Windows version of 
the code)

On the startup sequence refactoring in general:

Yeah, eventually being able to eliminate getpath.c in favour of a froze 
_getpath.py module has been one of my long term hopes for the PEP 432 startup 
sequence refactoring. The underlying issue making that difficult that is that 
it's always been murky as to exactly what Python code could safely execute at 
the point where that path information needs to be calculated, and the tests of 
path configuration are weak enough that it's easy to introduce regressions even 
with small changes, let alone a wholesale rewrite.


If a new setting is genuinely needed, then where to put things in the new 
config is still open for discussion - at the moment, it's pretty much just a 
straight transcription of the way CPython has historically done things, and is 
hence heavy on the use of low level C data types (especially wchar* where paths 
are concerned).

This means that the CoreConfig struct currently still contains a lot of things 
that aren't actually needed if all you want is a running Python interpreter and 
can live without a fully populated sys module.

The *advantage* of that approach is that it means it still maps pretty easily 
to the existing Py_Initialize approach: the PySet_* API writes to a global copy 
of a the CoreConfig struct, and then Py_Initialize reads that in to the active 
runtime state.

--

___
Python tracker 

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



[issue34906] Fix typo in the documentation

2018-10-06 Thread Julien Palard

Julien Palard  added the comment:


New changeset 683281f536981da395575b5a07d6761118259fd2 by Julien Palard 
(Stéphane Wirtel) in branch 'master':
bpo-34906: Doc: Fix typos (2) (GH-9735)
https://github.com/python/cpython/commit/683281f536981da395575b5a07d6761118259fd2


--

___
Python tracker 

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



[issue32174] nonASCII punctuation characters can not display in python363.chm.

2018-10-06 Thread Steve Dower


Steve Dower  added the comment:

Until someone creates and enables a Sphinx extension/option to only generate 
ASCII output, it will remain. Volunteers are welcome

--

___
Python tracker 

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



[issue34915] LWPCookieJar.save() creates *.lwp file in 644 mode

2018-10-06 Thread Ales Kvapil


New submission from Ales Kvapil :

The LWPCookieJar.save() creates an *.lwp file containing session cookies in 
non-safe 644 mode (everyone can read it). This is not a secure behavior, 
especially for storing session keys or session cookies. The file should be 
created in 600 mode in my opinion.

https://github.com/python/cpython/blob/3.7/Lib/http/cookiejar.py#L1872

--
assignee: christian.heimes
components: IO, Library (Lib), SSL
messages: 327246
nosy: aleskva, christian.heimes
priority: normal
severity: normal
status: open
title: LWPCookieJar.save() creates *.lwp file in 644 mode
type: security
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



[issue34909] StrEnum subclasses cannot be created

2018-10-06 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

Ethan,

I think you have fixed the issue, could you close this issue?

Thank you

--

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-10-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

After this change tests are failed when ran with -Werror.

$ ./python -Werror -m test -vuall -m 'test_semaphore_tracker_sig*' 
test_multiprocessing_fork test_multiprocessing_forkserver 
test_multiprocessing_spawn
...
==
ERROR: test_semaphore_tracker_sigkill 
(test.test_multiprocessing_fork.TestSemaphoreTracker)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4562, 
in test_semaphore_tracker_sigkill
self.check_semaphore_tracker_death(signal.SIGKILL, True)
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4526, 
in check_semaphore_tracker_death
_semaphore_tracker.ensure_running()
  File "/home/serhiy/py/cpython/Lib/multiprocessing/semaphore_tracker.py", line 
64, in ensure_running
warnings.warn('semaphore_tracker: process died unexpectedly, '
UserWarning: semaphore_tracker: process died unexpectedly, relaunching.  Some 
semaphores might leak.

--
...
==
ERROR: test_semaphore_tracker_sigint 
(test.test_multiprocessing_forkserver.TestSemaphoreTracker)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4554, 
in test_semaphore_tracker_sigint
self.check_semaphore_tracker_death(signal.SIGINT, False)
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4526, 
in check_semaphore_tracker_death
_semaphore_tracker.ensure_running()
  File "/home/serhiy/py/cpython/Lib/multiprocessing/semaphore_tracker.py", line 
64, in ensure_running
warnings.warn('semaphore_tracker: process died unexpectedly, '
UserWarning: semaphore_tracker: process died unexpectedly, relaunching.  Some 
semaphores might leak.

==
ERROR: test_semaphore_tracker_sigkill 
(test.test_multiprocessing_forkserver.TestSemaphoreTracker)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4562, 
in test_semaphore_tracker_sigkill
self.check_semaphore_tracker_death(signal.SIGKILL, True)
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4534, 
in check_semaphore_tracker_death
sem = ctx.Semaphore()
  File "/home/serhiy/py/cpython/Lib/multiprocessing/context.py", line 82, in 
Semaphore
return Semaphore(value, ctx=self.get_context())
  File "/home/serhiy/py/cpython/Lib/multiprocessing/synchronize.py", line 126, 
in __init__
SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX, ctx=ctx)
  File "/home/serhiy/py/cpython/Lib/multiprocessing/synchronize.py", line 80, 
in __init__
register(self._semlock.name)
  File "/home/serhiy/py/cpython/Lib/multiprocessing/semaphore_tracker.py", line 
104, in register
self._send('REGISTER', name)
  File "/home/serhiy/py/cpython/Lib/multiprocessing/semaphore_tracker.py", line 
111, in _send
self.ensure_running()
  File "/home/serhiy/py/cpython/Lib/multiprocessing/semaphore_tracker.py", line 
64, in ensure_running
warnings.warn('semaphore_tracker: process died unexpectedly, '
UserWarning: semaphore_tracker: process died unexpectedly, relaunching.  Some 
semaphores might leak.

--
...
==
ERROR: test_semaphore_tracker_sigint 
(test.test_multiprocessing_spawn.TestSemaphoreTracker)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4554, 
in test_semaphore_tracker_sigint
self.check_semaphore_tracker_death(signal.SIGINT, False)
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4526, 
in check_semaphore_tracker_death
_semaphore_tracker.ensure_running()
  File "/home/serhiy/py/cpython/Lib/multiprocessing/semaphore_tracker.py", line 
64, in ensure_running
warnings.warn('semaphore_tracker: process died unexpectedly, '
UserWarning: semaphore_tracker: process died unexpectedly, relaunching.  Some 
semaphores might leak.

==
ERROR: test_semaphore_tracker_sigkill 
(test.test_multiprocessing_spawn.TestSemaphoreTracker)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/test/_test_multiprocessing.py", line 4562, 
in test_semaphore_tracker_sigkill

[issue31310] semaphore tracker isn't protected against crashes

2018-10-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Sorry, that bug was actually introduced in issue33613.

--
stage: needs patch -> 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



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-10-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

One bug or feature request per issue please. If you want to change list.index() 
or operator.indexOf(), open new issues for this. This issue is for the error in 
the range.index() docstring.

--

___
Python tracker 

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



[issue34848] range.index only takes one argument when it's documented as taking the usual 3

2018-10-06 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34876] Python3.8 changes how decorators are traced

2018-10-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See 09aaa88328a5083469b2682230c7f3c62942afab. The position of the AST node for 
decorated function and class was changed to the position of the first 
decorator. It was made to help inspect.getsource() for functions to include 
decorator lines in the result. But the position of `def` and `class` lines was 
lost.

--
nosy: +christian.heimes, georg.brandl

___
Python tracker 

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



[issue34905] Cannot assign memoryview values from array.array

2018-10-06 Thread Stefan Krah


Stefan Krah  added the comment:

>>> mview.format
'B'
>>> mview[:] = array.array('B', b'hello')


Bytes have format 'B', so this works as expected.

--
assignee:  -> skrah
nosy: +skrah
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



[issue33342] urllib IPv6 parsing fails with special characters in passwords

2018-10-06 Thread Thomas Jollans


Thomas Jollans  added the comment:

RFC 2396 explicitly excludes the use of [ and ] in URLs. RFC 2732 
 defines the syntax for IPv6 URLs, and 
allows [ and ] ONLY in the host part.

So I'd say that the behaviour is arguably correct (if somewhat unfortunate)

--
nosy: +tjollans

___
Python tracker 

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



[issue34891] Multi-processing example inaccurate warning

2018-10-06 Thread Anthony Flury


Anthony Flury  added the comment:

An example that does work : 

$ python3

  Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
  [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
  Type "help", "copyright", "credits" or "license" for more information.

  >>> from multiprocessing import Pool
  >>> def f(x): 
  ... return x**2
  ...
  >>> with Pool(10) as p:
  ... print(p.map(f, range(1,10)))
  [1, 4, 9, 16, 25, 36, 49, 64, 81]

So something about having Pool as a context manager means it works - very odd 
then.

BTW - with the exception of the example saying 'don't do this it doesn't work', 
none of the examples on the page are shown on the command line interpreter; but 
the first example uses a Pool context manager - which works as above.

--

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-06 Thread Mike Gleen


Mike Gleen  added the comment:

Thanks for the quick response. I would be happy to write a pull request for
the doc change. I've never done this before so it'll take a little while to
get my head around the process, but the "Helping with Documentation"
chapter seems good.

Mike

On Sat, Oct 6, 2018 at 7:09 AM Karthikeyan Singaravelan <
rep...@bugs.python.org> wrote:

>
> Karthikeyan Singaravelan  added the comment:
>
> In addition to %d there are also other items that support single digit
> though zero padding is mentioned with strptime as below in the context of
> strftime :
>
> >>> import datetime
> >>> datetime.datetime.strptime("1/1/2018 1:1:1", "%d/%m/%Y %I:%M:%S")
> datetime.datetime(2018, 1, 1, 1, 1, 1)
>
>
> >>> datetime.datetime.strftime(datetime.datetime(year=2018, month=1,
> day=1, hour=1, second=1, minute=1), "%d/%m/%Y %I:%M:%S")
> '01/01/2018 01:01:01'
>
> I couldn't find exact set of words that can be used to denote that zero
> padding is optional in strptime and it's returned as zero padded in
> strftime but if we are changing %d then I propose changing other items too
> with similar wording.
>
> Thanks
>
> --
> nosy: +xtreak
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue34905] Cannot assign memoryview values from array.array

2018-10-06 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34914] Clarify text encoding used to enable UTF-8 mode

2018-10-06 Thread Nick Coghlan


New submission from Nick Coghlan :

While working on the docs updates for bpo-34589 (clarifying that 
"PYTHONCOERCECLOCALE=0" and "PYTHONCOERCELOCALE=warn" need both the environment 
variable name and the value to be encoded as ASCII in order to have any 
effect), I realised that it was less explicit how to reliably enable UTF-8 
mode, since that can be enabled even when the current locale is a nominally 
ASCII-incompatible one like gb18030, and the command line settings get 
processed as wchar strings rather than 8-bit char strings.

>From what I've been able to figure out, the environment variable case is the 
>same as for locale coercion: both the environment variable name and the value 
>need to be encoded as ASCII. This actually happens implicitly, as even 
>encodings like gb18030 still encode ASCII letters and numbers the same way 
>ASCII does - their incompatibilities with ASCII lie elsewhere. Fully 
>incompatible encodings like UTF-16 and UTF-32 don't get used as locale 
>encodings in the first place because they'd break too many applications.

I believe the same holds true for the command line arguments, just in the other 
direction: they get converted to wchar* with either mbstowcs or mrbtowc, and 
then compared using wcscmp or wcsncmp, but for all encodings that actually get 
used as locale encodings, the ASCII code points that CPython cares about get 
mapped directly to the corresponding UTF-16-LE or UTF-32 code point at both 
compile time (in the code) and at runtime (when reading the arg string).

Given that simply not thinking about the problem will actually do the right 
thing in all cases, I don't think this needs to be documented prominently, but 
I do think it would be good to explicitly address the point somewhere.

--
assignee: docs@python
components: Documentation
messages: 327236
nosy: docs@python, eric.snow, ncoghlan, vstinner
priority: low
severity: normal
stage: needs patch
status: open
title: Clarify text encoding used to enable UTF-8 mode
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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-10-06 Thread Vinodhini


Vinodhini  added the comment:

This is now carried forward in 3.8 also. Is anyone working on this issue ?
It needs to be corrected in doc-string for all method where its applicable

--
nosy: +Vinu2003

___
Python tracker 

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



[issue34909] StrEnum subclasses cannot be created

2018-10-06 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset 453b3b0e87cb16345c276b9064a4480ce3794a74 by Ethan Furman (Miss 
Islington (bot)) in branch '3.7':
bpo-34909: keep searching mixins until base class is found (GH-9737) (GH-9738)
https://github.com/python/cpython/commit/453b3b0e87cb16345c276b9064a4480ce3794a74


--

___
Python tracker 

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



[issue34910] PyObject_Print() doesn't always return -1 on error

2018-10-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you Zackery for catching such kind of errors.

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



[issue34910] PyObject_Print() doesn't always return -1 on error

2018-10-06 Thread miss-islington


miss-islington  added the comment:


New changeset 177254c96f9258a62e3e571c2aee0b642070a374 by Miss Islington (bot) 
in branch '3.6':
bpo-34910: Ensure that PyObject_Print() always returns -1 on error. (GH-9733)
https://github.com/python/cpython/commit/177254c96f9258a62e3e571c2aee0b642070a374


--
nosy: +miss-islington

___
Python tracker 

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



[issue34910] PyObject_Print() doesn't always return -1 on error

2018-10-06 Thread miss-islington


miss-islington  added the comment:


New changeset 49fb49d6f57661f2a7601f1d759163866f707fed by Miss Islington (bot) 
in branch '3.7':
bpo-34910: Ensure that PyObject_Print() always returns -1 on error. (GH-9733)
https://github.com/python/cpython/commit/49fb49d6f57661f2a7601f1d759163866f707fed


--

___
Python tracker 

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



[issue34913] Document gzip command line interface

2018-10-06 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

gzip supports command line interface with `python -m gzip` like zipfile and 
tarfile but there is no help available from the command line which can be 
covered when issue23596 is merged that uses argparse along with tests for which 
are also lacking at the moment. There can be at least docs about command line 
arguments at https://docs.python.org/3/library/gzip.html. Currently there is no 
way to know how the command line interface works for gzip without looking at 
the source code.

--
assignee: docs@python
components: Documentation
messages: 327230
nosy: docs@python, xtreak
priority: normal
severity: normal
status: open
title: Document gzip command line interface
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



[issue34910] PyObject_Print() doesn't always return -1 on error

2018-10-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9127

___
Python tracker 

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



[issue34910] PyObject_Print() doesn't always return -1 on error

2018-10-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ae62f015240c9162773341a9922794e6b960779d by Serhiy Storchaka 
(Zackery Spytz) in branch 'master':
bpo-34910: Ensure that PyObject_Print() always returns -1 on error. (GH-9733)
https://github.com/python/cpython/commit/ae62f015240c9162773341a9922794e6b960779d


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue34910] PyObject_Print() doesn't always return -1 on error

2018-10-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9126

___
Python tracker 

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



[issue34909] StrEnum subclasses cannot be created

2018-10-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9125

___
Python tracker 

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



[issue34909] StrEnum subclasses cannot be created

2018-10-06 Thread Ethan Furman


Ethan Furman  added the comment:


New changeset cd45385ffad8910293e5659cfe7ab036e70613b7 by Ethan Furman in 
branch 'master':
bpo-34909: keep searching mixins until base class is found (GH-9737)
https://github.com/python/cpython/commit/cd45385ffad8910293e5659cfe7ab036e70613b7


--

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-06 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

In addition to %d there are also other items that support single digit though 
zero padding is mentioned with strptime as below in the context of strftime : 

>>> import datetime
>>> datetime.datetime.strptime("1/1/2018 1:1:1", "%d/%m/%Y %I:%M:%S")
datetime.datetime(2018, 1, 1, 1, 1, 1)


>>> datetime.datetime.strftime(datetime.datetime(year=2018, month=1, day=1, 
>>> hour=1, second=1, minute=1), "%d/%m/%Y %I:%M:%S")
'01/01/2018 01:01:01'

I couldn't find exact set of words that can be used to denote that zero padding 
is optional in strptime and it's returned as zero padded in strftime but if we 
are changing %d then I propose changing other items too with similar wording.

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue33173] GzipFile's .seekable() returns True even if underlying buffer is not seekable

2018-10-06 Thread Martin Panter

Martin Panter  added the comment:

If a change is made, it would be nice to bring the “gzip”, “bzip” and LZMA 
modules closer together. The current “bzip” and LZMA modules rely on the 
underlying “seekable” method without a fallback implementation, but also have a 
check for read mode.

I think the seeking functionality in these modules is a misfeature. But since 
it is already here, it is probably best to leave it alone, and just document it.

My comment about making “seekable” stricter is at 
. Even 
if the underlying stream is not seekable, GzipFile can still fast-forward. Here 
is a demonstration:

>>> z = BytesIO(bytes.fromhex(
... "1F8B080002FFF348CD29D051F05448CC55282E294DCE56C8CC53485448AFCA"
... "2C5048CBCC490500F44BF0A01F00"
... ))
>>> def seek(*args): raise UnsupportedOperation()
... 
>>> z.seek = seek  # Make the underlying stream not seekable
>>> f = GzipFile(fileobj=z)
>>> f.read(10)
b'Help, I am'
>>> f.seek(20)  # Fast forward
20
>>> f.read()
b'a gzip file'
>>> f.seek(0)  # Rewind
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/proj/python/cpython/Lib/gzip.py", line 368, in seek
return self._buffer.seek(offset, whence)
  File "/home/proj/python/cpython/Lib/_compression.py", line 137, in seek
self._rewind()
  File "/home/proj/python/cpython/Lib/gzip.py", line 515, in _rewind
super()._rewind()
  File "/home/proj/python/cpython/Lib/_compression.py", line 115, in _rewind
self._fp.seek(0)
  File "/home/proj/python/cpython/Lib/gzip.py", line 105, in seek
return self.file.seek(off)
  File "", line 1, in seek
io.UnsupportedOperation

--

___
Python tracker 

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