[issue34840] dlopen() error with no error message from dlerror()

2018-09-28 Thread shuoz


New submission from shuoz :

python _ctypes.dlclose(arg). 
Never check the arg  so we get a Segmentation fault (core dumped)

poc.py
```
import _ctypes
_ctypes.dlclose(3)  # 3-4294967296
```
python poc.py


gdb info

```
--registers---]
RAX: 0x77ffcca0 --> 0x40d0d 
RBX: 0x0 
RCX: 0x76a49fd0 (:movrax,QWORD PTR [rip+0x201fe1] 
   # 0x76c4bfb8)
RDX: 0x2e10a0bf96213a9d 
RSI: 0x0 
RDI: 0x3 
RBP: 0x76a49fd0 (:movrax,QWORD PTR [rip+0x201fe1] 
   # 0x76c4bfb8)
RSP: 0x7fffd280 --> 0x0 
RIP: 0x77dee161 (<_dl_close+1>: test   BYTE PTR [rdi+0x3d4],0x8)
R8 : 0x3 
R9 : 0x76a49fd0 (:movrax,QWORD PTR [rip+0x201fe1] 
   # 0x76c4bfb8)
R10: 0xc55dc0 --> 0x31 ('1')
R11: 0x77eec3d8 --> 0x9 ('\t')
R12: 0x3 
R13: 0x77e952b0 --> 0x1 
R14: 0x72d12140 (: push   r14)
R15: 0x77e17228 --> 0x16
EFLAGS: 0x10246 (carry PARITY adjust ZERO sign trap INTERRUPT direction 
overflow)
[-code-]
   0x77dee152:  nopDWORD PTR [rax+0x0]
   0x77dee156:  nopWORD PTR cs:[rax+rax*1+0x0]
   0x77dee160 <_dl_close>:  push   rbx
=> 0x77dee161 <_dl_close+1>:test   BYTE PTR [rdi+0x3d4],0x8
   0x77dee168 <_dl_close+8>:movrbx,rdi
   0x77dee16b <_dl_close+11>:   jne0x77dee210 <_dl_close+176>
   0x77dee171 <_dl_close+17>:   movedx,DWORD PTR [rdi+0x310]
   0x77dee177 <_dl_close+23>:   test   edx,edx
[stack-]
| 0x7fffd280 --> 0x0 
0008| 0x7fffd288 --> 0x77de7564 (<_dl_catch_error+116>: mov
rax,QWORD PTR [rsp+0x8])
0016| 0x7fffd290 --> 0x0 
0024| 0x7fffd298 --> 0x77fd8720 --> 0x7fffd2e0 --> 0x7737f690 
--> 0x0 
0032| 0x7fffd2a0 --> 0x0 
0040| 0x7fffd2a8 --> 0x7737f690 --> 0x0 
0048| 0x7fffd2b0 --> 0x7737f698 --> 0x0 
0056| 0x7fffd2b8 --> 0x7737f688 --> 0x0 
[--]
Legend: code, data, rodata, value
Stopped reason: SIGSEGV
_dl_close (_map=0x3) at dl-close.c:809
809 dl-close.c: No such file or directory.
gdb-peda$ bt
```

--
components: ctypes
messages: 326668
nosy: shuoz
priority: normal
severity: normal
status: open
title: dlopen() error with no error message from dlerror()
type: crash
versions: Python 3.5

___
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-09-28 Thread Tim Peters


Tim Peters  added the comment:

Jeroen, thanks for helping us fly slightly less blind! ;-) It's a lot of work.

I'd say you may as well pick a prime.  It's folklore, but "a reason" is that 
you've discovered that regular bit patterns in multipliers can hurt, and 
sticking to primes eliminates worlds of simple & subtle bit patterns.

Another bit of folklore:  pick a multiplier such that for each byte, neither it 
nor its complement are close in value to any other byte of the multiplier.  
Which may seem more valuable for byte-oriented hashes, yet the byte-oriented 
FNV violates it spectacularly:  all FNV multipliers have _no_ bits set higher 
than 2**8 except for their leading bit.  So the longer the FNV multiplier, the 
more all-0 bytes it contains.

Which appears to be a deliberate choice to limit how quickly each new input 
byte propagates to other lower-order state bits across iterations.  The DJB33 
algorithms accomplish that by using a tiny multiplier (relative to the output 
hash width) instead.

As I explained in other msgs here, treating tuple component hashes as sequences 
of bytes seems to deliver excellent results with the unaltered byte-oriented 
versions of FNV-1[a] and DJBX33[AX] - too good for anything in my test 
collection to detect anything even suspicious, let alone "a problem" (although 
it would be easy to contrive problem cases for 33[AX] - 33 is way "too small" 
to avoid collisions even across tuples with a single component).

So part of our challenge appears to me to be that we're trying instead to 
produce a hash from inputs of the _same_ bit width.  DJB/FNV were designed to 
produce hashes of width at least 4 times their inputs' bit widths.  Each input 
has a relatively tiny effect on the internal state for them.  For us, each 
input can change the entire internal state.

--

___
Python tracker 

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



[issue29001] logging.handlers.RotatingFileHandler rotation broken under gunicorn

2018-09-28 Thread Berker Peksag


Change by Berker Peksag :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue29001] logging.handlers.RotatingFileHandler rotation broken under gunicorn

2018-09-28 Thread Vinay Sajip


Vinay Sajip  added the comment:

It's not Gunicorn-specific - more a case of multiple processes writing to a 
single log file. This is not supported directly, as documented here:

https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes

As the cookbook says, you can set up a separate process to handle logging to 
file, which listens with a socket server or a multiprocessing QueueListener; 
your worker processes would communicate with it using either a SocketHandler or 
a QueueHandler, as appropriate.

--

___
Python tracker 

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



[issue34831] Asyncio Tutorial

2018-09-28 Thread Yury Selivanov


Yury Selivanov  added the comment:

I like this, great job!


Couple of thoughts on how we should organize this:

* I think we should stick to your structure and push things to docs.python.org 
as soon as every next section is somewhat ready.

* Every big section should probably have its own page, linking prev/next 
tutorial pages.

* I'd organize the tutorial in a dedicated directory like 
"Doc/library/asyncio-tutorial/".  Context: I wanted to reorganize all current 
"Doc/library/asyncio*.rst" files under one dir too, but decided to keep the 
existing file structure to avoid breaking links to the docs from SO/google).  
We shouldn't repeat that mistake again.

BTW, maybe we should consider using the new iPythonn async repl: 
https://blog.jupyter.org/ipython-7-0-async-repl-a35ce050f7f7   What do you 
think about that?


Some comments on the proposed TOC:

>- Reason #1: thread safety by not using threads at all.
>- Reason #2: very many concurrent socket connections, which threads
>  make cumbersome.

This section is super important to get right, as I see people ask the "why and 
where should I use asyncio" _all_ _the_ _time_.  So I'll expand on this section 
in a detail.

Reason #1 and #2 are correct, but I think we should really focus on making #1 
comprehensive and clear:

* async/await makes all context switches visible; that makes it easy to spot 
race conditions and reason about your code (think about ORMs that can make 100s 
of queries to render one web page); you've likely seen 
https://glyph.twistedmatrix.com/2014/02/unyielding.html

* in general, all datastructures are safe for async (we cannot say same for 
threads);

* an async/await library means that it's safe to use it in concurrent 
async/await code (you can never be sure if some library is thread-safe, even if 
it claims that);

* language constructs like 'async for' and 'async with' enable structured 
concurrency;

And on #2:

* high-throughput IO or 1000s of long-living connections are only doable with 
asyncio

* if you don't need to scale your code right now but might need in near future 
investing in async/await is wise


>- How to run `async def` functions
>- point out there are two different issues: (a) `async def` functions
>  can call other functions, and other `async def` functions using
>  `await`, but also, (b) how to "get started" with the first
>  `async def` function? Answer: run the event loop.

Just a quick note: I'd try to not mention the low-level loop APIs as long as 
possible (e.g. no loop.run_until_complete() etc).


- Dealing with concurrent functions
- (This is maybe too similar to the new docs in the section
  
https://docs.python.org/3/library/asyncio-task.html?highlight=asyncio%20run#coroutines-and-tasks)

Right, we'll need to update the asyncio-task.rst file.  I think we'll collapse 
first two section into one ("Coroutines" and "Awaitables" into "Awaitables") 
and link the tutorial from that new section.


> - Case Study: chat server/client (my proposal)
> [..]
> - server uses streams API

Yay for streams!

> [..]
> - client implementation has some options:

I never use tkinter myself :( I remember trying to use it and it didn't work on 
my macOS.  So I'd try to either:

* build a simple browser app (that would require us to implement HTTP 0.9 which 
can be fun);
* build a terminal app;
* use iPython repl to connect to our asyncio server (might end up being more 
complicated than the first two options).

--
nosy: +Elvis.Pranskevichus

___
Python tracker 

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



[issue34609] Importing certain modules while debugging raises an exception

2018-09-28 Thread Brett Cannon


Brett Cannon  added the comment:

The failure line that Cheryl found in her traceback is at 
https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap.py#L101 .

Maybe Antoine has an idea since he did a bunch of work on import locking?

--
nosy: +pitrou

___
Python tracker 

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



[issue34839] doctest: Change example under warnings section

2018-09-28 Thread Cheryl Sabella


New submission from Cheryl Sabella :

The Warnings section of the doctest documentation 
(https://docs.python.org/3.8/library/doctest.html#warnings) contains an example 
that the printing order of a dictionary is not guaranteed.  Since it is now 
guaranteed to be insertion order, perhaps the example should be changed.

--
assignee: docs@python
components: Documentation
messages: 326663
nosy: cheryl.sabella, docs@python
priority: normal
severity: normal
status: open
title: doctest: Change example under warnings section
type: enhancement
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



[issue34832] "Short circuiting" in base64's b64decode, decode, decodebytes

2018-09-28 Thread Felipe Rodrigues


Felipe Rodrigues  added the comment:

Actually, I'm not even sure if it makes sense to decode the 'first valid 
substring'... IMHO, we should warn the user

--

___
Python tracker 

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



[issue34832] "Short circuiting" in base64's b64decode, decode, decodebytes

2018-09-28 Thread Felipe Rodrigues


Felipe Rodrigues  added the comment:

I am not sure if simply ignoring the non-valid character is the best way to go. 
Feels like silencing errors.

b64decode does accept the 'validate' flag - defaulted to False - that will halt 
the execution and throw an error.

What might be a good idea is to implement an 'errors' argument that accepts 
'ignore' as a value, like we do for bytes.decode 
(https://docs.python.org/3/library/stdtypes.html#bytes.decode)

--
nosy: +fbidu

___
Python tracker 

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



[issue34838] Improve arg clinic code generation for cases with type checking

2018-09-28 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve

2018-09-28 Thread Laurent Gautier


Laurent Gautier  added the comment:

@mattip : do you mean that it can currently be achieved by calling `cast` with 
a specific shape parameter ? If the case, how so ?

--

___
Python tracker 

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



[issue29001] logging.handlers.RotatingFileHandler rotation broken under gunicorn

2018-09-28 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +vinay.sajip
versions: +Python 3.8 -Python 2.7

___
Python tracker 

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



[issue29001] logging.handlers.RotatingFileHandler rotation broken under gunicorn

2018-09-28 Thread Umesh Pathak


Change by Umesh Pathak :


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

___
Python tracker 

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



[issue34779] IDLE internals show up in tracebacks when returning objects that cannot be `repr`ed

2018-09-28 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue9056] Adding additional level of bookmarks and section numbers in python pdf documents.

2018-09-28 Thread Cheryl Sabella


Change by Cheryl Sabella :


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



[issue34838] Improve arg clinic code generation for cases with type checking

2018-09-28 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue34838] Improve arg clinic code generation for cases with type checking

2018-09-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue34838] Improve arg clinic code generation for cases with type checking

2018-09-28 Thread Raymond Hettinger


New submission from Raymond Hettinger :

An arg clinic specification such as

p: object(subclass_of='&PyTuple_Type')

generates slow code using _PyArg_ParseStack() that has to parse a format string 
like "O!" to decide to make a type check.  Instead, it should directly generate 
a branch-predictable test for the type check and then call the much quicker 
function _PyArg_UnpackStack().

See https://github.com/python/cpython/pull/9628 for an example of this change 
giving a 30% speedup.

--
components: Argument Clinic
messages: 326659
nosy: larry, rhettinger, serhiy.storchaka, vstinner
priority: low
severity: normal
status: open
title: Improve arg clinic code generation for cases with type checking
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



[issue34837] Multiprocessing.pool API Extension - Pass Data to Workers w/o Globals

2018-09-28 Thread Sean Harrington


Change by Sean Harrington :


--
title: Multiprocessing.pool API Extension - Non-Global Initialization of 
Workers -> Multiprocessing.pool API Extension - Pass Data to Workers w/o Globals

___
Python tracker 

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



[issue34370] Tkinter scroll issues on macOS

2018-09-28 Thread Ned Deily


Ned Deily  added the comment:

Thanks for testing, Vlad.  And thanks for the followup, Kevin.  I guess we'll 
wait to hear more from Kevin.

--

___
Python tracker 

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



[issue34828] sqlite.iterdump does not work for (most) databases with autoincrement

2018-09-28 Thread Joel Klimont


Joel Klimont  added the comment:

I made the pull request: https://github.com/python/cpython/pull/9621

--

___
Python tracker 

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



[issue25812] locale.nl_langinfo() can't decode value

2018-09-28 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
assignee:  -> nnja

___
Python tracker 

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



[issue34837] Multiprocessing.pool API Extension - Non-Global Initialization of Workers

2018-09-28 Thread Sean Harrington


Change by Sean Harrington :


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

___
Python tracker 

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



[issue34837] Multiprocessing.pool API Extension - Non-Global Initialization of Workers

2018-09-28 Thread Sean Harrington


Change by Sean Harrington :


--
components: Library (Lib)
nosy: seanharr11
priority: normal
severity: normal
status: open
title: Multiprocessing.pool API Extension - Non-Global Initialization of Workers
type: enhancement
versions: 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



[issue34771] test_ctypes failing on Linux SPARC64

2018-09-28 Thread Frank Schaefer


Frank Schaefer  added the comment:

FYI the libffi bug report is open here:

https://github.com/libffi/libffi/issues/451

As noted in the bug report, this issue actually doesn't appear to impact ARM64 
(or ARM32 GNUEABI/GNUEABIHF).

--

___
Python tracker 

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



[issue34797] Convert heapq to the argument clinic

2018-09-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue34797] Convert heapq to the argument clinic

2018-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset e2f48bf0e851dc79d888c70fd24c631a8a9e1030 by Raymond Hettinger 
(Pablo Galindo) in branch 'master':
bpo-34797: Convert heapq to the argument clinic (GH-9560)
https://github.com/python/cpython/commit/e2f48bf0e851dc79d888c70fd24c631a8a9e1030


--

___
Python tracker 

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



[issue34370] Tkinter scroll issues on macOS

2018-09-28 Thread Vlad Tudorache


Vlad Tudorache  added the comment:

The scroll problem (clicking on the upper half of the slider is taken as 
"through1") still persists for me on Mojave with 3.7.1 RC1 downloaded from 
python.org and including Tcl/Tk.

--

___
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-09-28 Thread Tim Peters


Tim Peters  added the comment:

[Tim]
> Perhaps worth noting that FNV-1a works great if used as
> _intended_:  on a stream of unsigned bytes.
> ...
>
>Py_uhash_t t = (Py_uhash_t)y;
>for (int i = 0; i < sizeof(t); ++i) {
>x = (x ^ (t & 0xff)) * (Py_uhash_t)1099511628211ULL;
>t >>= 8;
>}

And that's all - no hacks for nested tuples, no hacks for mixed-sign ints, just 
100% pure FNV-1a.

So, just for fun, how about 100% pure Bernstein 33A or 33X?  Those replace the 
3rd line above with, respectively,

x = (x * 33) + (t & 0xff); // 33A

or

x = (x * 33) ^ (t & 0xff); // 33X


And those _also_ work great:  no collisions at all across my collection, except 
for the new tuple test, where they suffer 10 and 8 collisions respectively 
(note that the new test retains only the 32 least-significant hash bits).

Those are remarkable partly because multiplying by 33 is a weak permutation on 
its own:  it's just a left shift (by 5) and an add.  And while you can find odd 
multipliers with lower order (mod 2**N) than 33, you have to work to find one - 
it's exceptionally poor in this respect.  For example, pow(33, 8, 256) == 1, 
but half of the odd multipliers in range(256) have order 64 (mod 256).  Only 16 
of 'em have order <= 8.

Then again, we're applying that weak permutation 8 times per 64-bit input here, 
and folding in a fresh byte each time.  It seems that, overall, that's 
"stronger" than applying a stronger - but still easily spelled - permutation 
just one or two times to a 64-bit input.

The only thing I've tried using 64-bit ops that was comparably robust across 
these tests used the frozenset hash's permutation on the inputs:

Py_uhash_t t = (Py_uhash_t)y;
t = ((t ^ 89869747UL) ^ (t << 16)) * 3644798167UL;
x = (x * mult) + t;

That was quite insensitive to the choice of `mult`.  For example, in this 
instead:

Py_uhash_t t = (Py_uhash_t)y;
t ^= t << 1;
x = (x * mult) + t;

the original tuple test had 24 collision and the new test 6 using the current 
multiplier; changing to the FNV-1a 32-bit multiplier, those zoomed to 857 and 
44; then to the FNV-1a 64-bit multiplier, zoomed again to 477 and 2027; then to 
the "random" 1484268081, way down to 0 and 25; and finally to the "random" 
5517301966916670289, down to 0 and 4.  Which didn't inspire confidence ;-)

--

___
Python tracker 

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



[issue21109] tarfile: Traversal attack vulnerability

2018-09-28 Thread R. David Murray


Change by R. David Murray :


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



[issue34827] Make argparse.NameSpace iterable

2018-09-28 Thread paul j3


paul j3  added the comment:

As documented in 
https://docs.python.org/3/library/argparse.html#the-namespace-object

you can create your own 'namespace' class, that does everything you want and 
more.  argparse makes very few assumptions about the object - using getattr, 
setattr, and hasattr where possible.

All that the argparse.Namespace class adds to a plain object is the ability to 
set initial attributes, and to display them in a pretty way.

Look at Namespace.__repr__ to see how it accesses its attributes.

For a function with a

fn(*args, **kwargs)

signature, a namespace 'ns', can be passed in in 2 ways:

   fn(*ns._get_kwargs(), **ns.__dict__)

--
nosy: +paul.j3

___
Python tracker 

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



[issue21919] Changing cls.__bases__ must ensure proper metaclass inheritance

2018-09-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

As long as you can't crash CPython with this, this is the responsibility of the 
code that assigns to __bases__. If they don't take care, the program's behavior 
is undefined.

--

___
Python tracker 

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



[issue34797] Convert heapq to the argument clinic

2018-09-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue25812] locale.nl_langinfo() can't decode value

2018-09-28 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



[issue21919] Changing cls.__bases__ must ensure proper metaclass inheritance

2018-09-28 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

>  I am adding Raymond as part of triaging who might have a better explanation 
> about this. 

Guido, is this something we care about?  There is value in checking for 
metaclass conflicts when a class is created (to catch plausible mistakes and to 
assure that the right __new__() and __init__() methods run).  But 
post-creation, it's unclear whether there is value in rerunning checks and 
whether its even possible to know how other base classes might have affected 
the class creation.

Do this go in the "consenting adults" category (in the same way that we allow 
the __class__ attribute to be changed on instances without trying to verify 
whether it makes sense)?

--
assignee:  -> gvanrossum
nosy: +gvanrossum
versions: +Python 3.8 -Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



[issue25812] locale.nl_langinfo() can't decode value

2018-09-28 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
versions: +Python 3.8 -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



[issue15994] memoryview to freed memory can cause segfault

2018-09-28 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +gregory.p.smith
versions: +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



[issue34836] test_ssl.test_default_ecdh_curve needs no tls1.3 flag in 2.7, for now

2018-09-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue34834] test_ssl.test_options does not correctly account for built-in ctx defaults with openssl 1.1.1

2018-09-28 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue34768] Add documentation explaining __init__.py in packages

2018-09-28 Thread Éric Araujo

Éric Araujo  added the comment:

I think the expectation is that people will know about modules and packages 
long before they upload things to PyPI.  The import system and the packaging 
tools are two independent domains.

For example the official tutorial has an intro: 
https://docs.python.org/3/tutorial/modules.html#packages

--
nosy: +eric.araujo

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2018-09-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The DFA for the rule

with_stmt: 'with' ( with_item (',' with_item)* | '(' with_item (',' with_item)* 
[','] ')' ) ':' suite

is:

DFA for with_stmt   
  [512/2103]
  State 0
'with' -> 1
  State 1
'(' -> 2
with_item -> 3
  State 2
with_item -> 4
  State 3
',' -> 5
':' -> 6
  State 4
')' -> 7
',' -> 8
  State 5
with_item -> 3
  State 6
suite -> 10
  State 7
':' -> 6
  State 8
')' -> 7
with_item -> 4
  State 9
',' -> 5
':' -> 6
  State 10 (final)
  State 11
')' -> 7
',' -> 8

It works because the transition from State 1 into a "(" is going to prioritize 
the path:

0 -> 1 -> "(" -> 2

instead if 

0 -> 1 -> with_item -> 3

--

___
Python tracker 

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



[issue34835] Multiprocessing module update fails with pip3

2018-09-28 Thread Dr_Zaszus


Dr_Zaszus  added the comment:

No, you are right, thank you. But just to be clear, how do I update 
multiprocessing in python3 then?

--

___
Python tracker 

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



[issue34835] Multiprocessing module update fails with pip3

2018-09-28 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

``pip3 search multiprocessing`` says:

multiprocessing (2.6.2.1)- Backport of the multiprocessing package 
to Python 2.4 and 2.5

so you are trying to install a Python 2.4/2.5 package into Python 3.7, which 
naturally cannot work.

In Python 2.6+ multiprocessing is a std lib module and you don't need to use 
pip to install it. I'm not sure if pip works with Python 2.4 or 2.5, but if it 
does, you'll need to use the 2.4/2.5 version of pip to do the update, not pip3.

I'm going to close this as not a bug. If you disagree, please give reasons why 
you think it should be reopened.

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2018-09-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The Python grammar is already not LL(1) strictly. Take for example the 
production for "argument":

argument: ( test [comp_for] | test '=' test | '**' test | '*' test )

obviously the first sets of test and test are the same and is ambiguous, but 
the NDFAs are still able to produce DFAs that can generate a concrete syntax 
tree that allows the AST generation to disambiguate that the second test is a 
NAME and not any other thing. 

The rule with_stmt: 'with' ( with_item (',' with_item)* | '(' with_item (',' 
with_item)* [','] ')' ) ':' suite

will generate a similar scenario. The NDFAs will generate DFAs that will 
ultimately allow us to just skip the more external group of parenthesis when 
generating the nodes. This makes valid all these expressions:

 with (manager() as x, manager() as y):
 pass
 with (manager() as x, manager() as y,):
 pass
 with (manager()):
 pass
 with (manager() as x):
 pass
 with (((manager(:
 pass
 with manager( as x):

but not this one:

 with (((manager( as x:

the reason is that it assigns the first LPAR to the second production and it 
fails when searching for the one that is at the end. I think this limitation is 
OK.

If you want to play with that. here is a prototype of the implementation with 
some tests:

https://github.com/pablogsal/cpython/tree/parenthesized_with

--

___
Python tracker 

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



[issue34836] test_ssl.test_default_ecdh_curve needs no tls1.3 flag in 2.7, for now

2018-09-28 Thread Dimitri John Ledkov


Change by Dimitri John Ledkov :


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

___
Python tracker 

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



[issue34836] test_ssl.test_default_ecdh_curve needs no tls1.3 flag in 2.7, for now

2018-09-28 Thread Dimitri John Ledkov


New submission from Dimitri John Ledkov :

test_default_ecdh_curve fails, as ssl.OP_NO_TLSv1_3 is not set on the context. 
and the test case can only work with non-tls1.3 connections.

this indicates that the pull request that sprinkled ssl.OP_NO_TLSv1_3 
everywhere was not backported, taking into account all the other backports that 
did subsequently remove those flags in many test cases.

at the moment that test case is failing, but it would be nice if it didn't.

--
messages: 326644
nosy: xnox
priority: normal
severity: normal
status: open
title: test_ssl.test_default_ecdh_curve needs no tls1.3 flag in 2.7, for now
versions: Python 2.7

___
Python tracker 

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



[issue34835] Multiprocessing module update fails with pip3

2018-09-28 Thread Dr_Zaszus


New submission from Dr_Zaszus :

pip3 install --upgrade multiprocessing 

fails with a python2 error in 'setup.py': 
   print 'Macros:'
 ^
   SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print('Macros:')?

--
components: Installation
messages: 326643
nosy: Dr_Zaszus
priority: normal
severity: normal
status: open
title: Multiprocessing module update fails with pip3
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



[issue34802] asyncio.iscoroutine() documentation is wrong

2018-09-28 Thread Yury Selivanov


Change by Yury Selivanov :


--
pull_requests: +9023

___
Python tracker 

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



[issue34834] test_ssl.test_options does not correctly account for built-in ctx defaults with openssl 1.1.1

2018-09-28 Thread Dimitri John Ledkov


Change by Dimitri John Ledkov :


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

___
Python tracker 

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



[issue34834] test_ssl.test_options does not correctly account for built-in ctx defaults with openssl 1.1.1

2018-09-28 Thread Dimitri John Ledkov


New submission from Dimitri John Ledkov :

self.assertEqual(default, ctx.options) in test_options fails with openssl 1.1.1 
as it does not correctly account for OP_ENABLE_MIDDLEBOX_COMPAT. It is not 
defined by the python2.7 ssl module either.

either ssl.OP_ENABLE_MIDDLEBOX_COMPAT needs to be backported, or the test case 
should just add that constant in when openssl version is >= 1.1.1

--
messages: 326642
nosy: xnox
priority: normal
severity: normal
status: open
title: test_ssl.test_options does not correctly account for built-in ctx 
defaults with openssl 1.1.1
versions: Python 2.7

___
Python tracker 

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



[issue34687] asyncio: is it time to make ProactorEventLoop as the default event loop?

2018-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset 37aae9dcf18753b8ffda99d1a5758a90af852464 by Miss Islington (bot) 
(Victor Stinner) in branch 'master':
bpo-34687: Update asyncio doc for ProactorEventLoop (GH-9623)
https://github.com/python/cpython/commit/37aae9dcf18753b8ffda99d1a5758a90af852464


--
nosy: +miss-islington

___
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-09-28 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

I spent about 2 days doing an extensive study of the FNV and DJB algorithms. I 
share my conclusions below.

To be very clear what I mean, I am talking about the following algorithms (t is 
a tuple and m is the multiplier which is always assumed to be odd).

def FNV(t, m):
h = 1
for x in t:
h = ((h * m) ^ x) % 2**32
return h

def DJB(t, m):
h = 1
for x in t:
h = ((h * m) + x) % 2**32
return h

I am restricting to 32 bits because we need to support that anyway and because 
it's computationally easier than 64 bits.

I took the point of view of fixing two different tuples t and u and then seeing 
for which multipliers m a collision hash(t, m) == hash(u, m) occurs. Since the 
lower k bits of the hash depend only on the lower k bits of the multiplier, it 
is actually feasible to list all m's for which there is a collision; I wrote a 
C program to do that. Note that there are 2**31 possible odd multipliers and 
2**32 different possible hash values: so you expect about 0.5 collisions on 
average.

For the entries of the tuples, I took random integers in the range from 0 to 63 
(so the issue with negative numbers in FNV does not occur). I mostly considered 
tuples of length 4, 5 and 6.

It turns out that both algorithms have pairs (t, u) for which a massive number 
of collisions occur:

- For FNV, the tuples (12, 50, 52, 24, 3), (28, 18, 52, 56, 19) have 2**26 
collisions (all multipliers with lower byte 0x01, 0x7f, 0x81 or 0xff give 
collisions)
- For DJB, the tuples (22, 10, 12, 22, 29), (23, 14, 18, 26, 30) have 2**24 
collisions (all multipliers with lower byte 0xff give collisions)

However, when you then look at the multipliers for these bad cases, they all 
have a special structure in the lower bits of which there are 2 cases:

- A special bit pattern like 0x001, 0x003, 0x555, 0xccd, ...
- A zero of a low-degree polynomial like 0x9fa5 which is a zero of x^2 + x + 2 
modulo 2**16 (this may only be relevant for DJB)

In order to eliminate these 2 cases, I decided to fix the lower byte of the 
multiplier. I wanted it to be 3 or 5 mod 8 to have maximal multiplicative order 
and then I checked which byte had the worst algebraic relations and no obvious 
bit pattern. I decided to take 0xc5 as lower byte.

When considering only multipliers with 0xc5 as lower byte, I found no very bad 
cases. I checked lots of pairs of tuples of length <= 6 and entries <= 64 and 
the worst I could find was 8192 collisions for FNV and 1024 collisions for DJB. 
This maximum number was found for tuples of length 5. Also, the maximum number 
of collisions seems bounded as the bitsize increases. For a 25-bit hash, I got 
the same maximum numbers of collisions as for a 32-bit hash. So, the 
probability of getting a collision decreases by a factor of 2 for every bit 
added, which is what you want.

When testing various bounds on the entries and tuple lengths, DJB is generally 
a little bit better than FNV (by 2 metrics: the maximum number of collisions 
and the root-mean-square of the number of collisions).

So my conclusion would be to use DJB as core algorithm, taking care to pick a 
good multiplier (or at least not an obviously bad multiplier).

--

___
Python tracker 

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



[issue34687] asyncio: is it time to make ProactorEventLoop as the default event loop?

2018-09-28 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +9021

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2018-09-28 Thread Nick Coghlan


Nick Coghlan  added the comment:

Especially since the dynamic flexibility of ExitStack comes at a genuine 
runtime cost when unwinding the resource stack.

I also (very!) belatedly noticed that I never answered Julian's request for 
clarification about the potential grammar ambiguity, so going into detail about 
that now:

The first item in the grammar after the 'with' keyword is a 'test' node, which 
can already start with a parenthesis, which means a naive attempt at allowing 
grouping parentheses will likely fail to generate a valid LL(1) parser.

That doesn't mean a more sophisticated change isn't possible (and Pablo has 
apparently implemented one) - it just means that the required grammar update is 
going to be more complicated than just changing:

with_stmt: 'with' with_item (',' with_item)*  ':' suite

to be:

with_stmt: 'with' (with_items | '(' with_items ')') ':' suite
with_items: with_item (',' with_item)*

(That would need too much lookahead to decide whether an opening parenthesis 
belongs to the first 'with_item' in 'with_items' or if it's starting the 
alternative multi-line grouping construct)

--

___
Python tracker 

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



[issue34022] 6 tests fail using SOURCE_DATE_EPOCH env var

2018-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

> https://github.com/python/cpython/pull/9607 turns SOURCE_DATE_EPOCH into a 
> *default* rather than absolute override.

Once we decided to merge or reject this PR, we should maybe update the PEP 552 
to clarify the interaction with the SOURCE_DATE_EPOCH environment variable.

--

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2018-09-28 Thread Łukasz Langa

Łukasz Langa  added the comment:

This was closed without enough explanation. Suggesting people should use 
ExitStack due to a Python grammar deficiency is suboptimal to say the least.

This problem is coming back to users of Black due to Black's removal of 
backslashes. It's the only piece of our grammar where backslashes are required 
for readability which shows there's something wrong.

The syntax ambiguity that Nick is raising fortunately shouldn't be a problem 
because a single tuple is an invalid context manager. In other contexts if the 
organizational parentheses are matched by the with-statement and not by the 
underlying `test`, that's also fine since they were organizational this doesn't 
make the `test` invalid.

Pablo has a working patch for this, we intend to fix this wart for Python 3.8.

--
nosy: +lukasz.langa
resolution: wont fix -> 
stage:  -> patch review
status: closed -> open
versions: +Python 3.8 -Python 3.4

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2018-09-28 Thread Łukasz Langa

Change by Łukasz Langa :


--
assignee:  -> pablogsal
nosy: +pablogsal

___
Python tracker 

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



[issue34771] test_ctypes failing on Linux SPARC64

2018-09-28 Thread Martin Panter

Martin Panter  added the comment:

Seems to be a common theme on various 64-bit ABIs. There is already a fix for 
Python’s Windows copy of the FFI library (Issue 29565), and a “hack” for Arm 
and x86 Windows (again!): Issue 30353.

--
nosy: +martin.panter

___
Python tracker 

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



[issue34818] test.test_ssl.ThreadedTests.test_tls1_3 fails in 2.7 with AttributeError: __exit__

2018-09-28 Thread Roundup Robot


Change by Roundup Robot :


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



[issue34521] Multiple tests (test_socket, test_multiprocessing_*) fail due to incorrect recvmsg(2) buffer lengths, causing failures on FreeBSD CURRENT

2018-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

Pablo: I merged your PR on master, and backport it to 3.6 and 3.7. But I let 
you handle 2.7, since I expect a conflict :-)

--

___
Python tracker 

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



[issue34833] [CI] Azure Pipeline: Initialize Agent failed

2018-09-28 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +pablogsal

___
Python tracker 

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



[issue34833] [CI] Azure Pipeline: Initialize Agent failed

2018-09-28 Thread STINNER Victor


STINNER Victor  added the comment:

Ah, I found more info:

##[Error 1]
The agent: Hosted Agent lost communication with the server. Verify the machine 
is running and has a healthy network connection. For more information, see: 
https://go.microsoft.com/fwlink/?linkid=846610 

##[Error 2]
The request was failed due to an internal service error. Please try again.

--

___
Python tracker 

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



[issue34833] [CI] Azure Pipeline: Initialize Agent failed

2018-09-28 Thread STINNER Victor


New submission from STINNER Victor :

Error: "Initialize Agent failed". Sorry... I don't see any additional 
information, only this error message...

Failed build:
https://python.visualstudio.com/cpython/_build/results?buildId=31597&view=logs

Source:
https://github.com/python/cpython/pull/9619

It's not the first time that I see this issue.

--
components: Tests
messages: 326633
nosy: steve.dower, vstinner
priority: normal
severity: normal
status: open
title: [CI] Azure Pipeline: Initialize Agent failed
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



[issue34521] Multiple tests (test_socket, test_multiprocessing_*) fail due to incorrect recvmsg(2) buffer lengths, causing failures on FreeBSD CURRENT

2018-09-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 007fda436f707ac95c2fa8f8886efd9e09d5b630 by Victor Stinner (Miss 
Islington (bot)) in branch '3.7':
bpo-34521: Fix tests in test_multiprocessing_spawn to use correctly CMSG_SPACE 
(GH-9613) (GH-9619)
https://github.com/python/cpython/commit/007fda436f707ac95c2fa8f8886efd9e09d5b630


--

___
Python tracker 

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



[issue34817] Ellipsis docs has extra dot in the markdown that makes it look like .... (four dots)

2018-09-28 Thread Martin Panter

Martin Panter  added the comment:

In these situations, I use quotes or brackets to mention a symbol without using 
it as punctuation. Using words might also help. What about:

Ellipsis
  The same as the ellipsis literal “...”. Special value used [etc]

--
nosy: +martin.panter

___
Python tracker 

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



[issue34828] sqlite.iterdump does not work for (most) databases with autoincrement

2018-09-28 Thread Joel Klimont


Change by Joel Klimont :


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



[issue34832] "Short circuiting" in base64's b64decode, decode, decodebytes

2018-09-28 Thread Michael Harris


New submission from Michael Harris :

When given an invalid base64 string that starts with a valid base64 substring, 
the functions will return the decoded bytes only up to the substring rather 
then ignoring the non-alphabet character.

Examples:
>>> base64.b64decode("")
b'\x00\x00\x00\x00\x00\x00'
>>> base64.b64decode("AA=AA")
b'\x00\x00\x00\x00\x00\x00'
>>> base64.b64decode("AAA=A")
b'\x00\x00'

--
components: Library (Lib)
messages: 326630
nosy: pw.michael.harris
priority: normal
severity: normal
status: open
title: "Short circuiting" in base64's b64decode, decode, decodebytes
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue34810] Maximum and minimum value of C types integers from Python

2018-09-28 Thread Ammar Askar


Ammar Askar  added the comment:

What is the use case for getting the maximum and minimum of the fixed bit 
integers like `uint8`? It's a trivial formula to calculate those.

Now, if you're talking about platform dependent types like `int` and `long` 
then it might makes more sense to add such an api. Or is your end goal to just 
have an exception be raised when trying to fit a large number in a small type 
like in your example?

--
nosy: +ammar2

___
Python tracker 

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



[issue34831] Asyncio Tutorial

2018-09-28 Thread Caleb Hattingh


New submission from Caleb Hattingh :

Hi Yury,

As discussed, below is a very rough outline of a proposed TOC for an asyncio 
tutorial. No content has been written yet (only what you see below). I think we 
should nail down the TOC first.

Asyncio Tutorial


Proposed Table of Contents:

- Why asyncio?
- Reason #1: thread safety by not using threads at all.
- Reason #2: very many concurrent socket connections, which threads
  make cumbersome.
- Demo: concurrency without threads
- (only goals here are to *briefly* introduce the syntax, and then
  demonstrate concurrency without threads)
- show two tasks, one prints out integers 0-9, while the other
  prints out letters of the alphabet, A-I.
- pose the question: "they're running concurrently but we're
  not using threads: how is that possible?"
- explain that there is a thing called an "event loop" behind
  the scenes that allows execution to switch between the two
  every time one of them "waits".
- emphasize that you can easily spot where the switch can happen,
  it is where you see the "await" keyword. Switches will occur
  nowhere else.

- The difference between functions and `async def` functions
- async & await
- show `async def` functions, compare to `def` functions.  
- use inspect module to show what things actually are, e.g. function,
  coroutine function, coroutine, generator function, generator,
  asynchronous generator function, asynchronous generator.
- point out you can only use "await" inside an async def fn
- point out that `await ` is an expression, and you can
  use it in most places any other expression can be used.

- How to run `async def` functions
- point out there are two different issues: (a) `async def` functions
  can call other functions, and other `async def` functions using
  `await`, but also, (b) how to "get started" with the first
  `async def` function? Answer: run the event loop.
- show `asyncio.run()`, in particular running an `async def main()`
  function, which itself can call others.

- Dealing with concurrent functions
- (This is maybe too similar to the new docs in the section
  
https://docs.python.org/3/library/asyncio-task.html?highlight=asyncio%20run#coroutines-and-tasks)
- What if you want to run an `async def` function, but you don't
  want to wait for it? Answer: create a "task" for it.
- What if you want to run multiple functions concurrently, and you
  do want to wait for all of them to finish? Answer: use `gather`
  or `wait()`

- Case Study: chat server/client (my proposal)
- (goal is to walk through building a realistic example of using 
  asyncio)
- (This will be a lot more fun than a web-crawler. Web-crawlers are
  super boring!)
- (I'm pretty confident the size of the code can be kept small. A 
  lot can be done in under 50 lines, as I showed in the case studies
  in my book)
- server uses streams API
- server receives many long-lived connections
- user can create/join a "room", and then start typing messages.
  Other connected clients in the same room will see the messages.
- client implementation has some options:
- could use Tkinter gui, using streams API in an event loop 
  on a separate thread. (This would show how asyncio isn't some 
  alien thing, but is part of python. Would also show how to 
  set up asyncio to work in a separate thread. Finally, would not
  require any external dependencies, only the stdlib is needed
  for the entire case study.)
- could use a browser client, connecting back to the server 
  over a websocket connection. (This might seem simpler, but 
  in fact introduces a lot more complexity than just using
  tkinter. We need to bring in html, css, probably some js and
  probably also a third-party websockets python library. I feel
  like it isn't a good fit for a stdlib python tutorial, but it 
  is a more modern approach.)
- there are not a lot of other options. terminal-based client 
  might be possible, but probably hard, not cross-platform, and 
  will be unappealing to many people. 
- When describing the code, point out:
- you have to choose a "message protocol" (size-prefixed is fine)
- you must put `send` and `recv` in separate tasks
- server will "keep track" of connected clients and the room
  (or rooms?) they've joined
- startup and shutdown, specific references to the new `run()`
  function
- ?

--
assignee: docs@python
components: Documentation, asyncio
messages: 326628
nosy: asvetlov, cjrh, docs@python, willingc, yselivanov
priority: normal
severity: normal
status: open
title: Asyncio 

[issue34521] Multiple tests (test_socket, test_multiprocessing_*) fail due to incorrect recvmsg(2) buffer lengths, causing failures on FreeBSD CURRENT

2018-09-28 Thread miss-islington


miss-islington  added the comment:


New changeset 5d33ee1595767d68800fda13bc68b7b01dba5117 by Miss Islington (bot) 
in branch '3.6':
bpo-34521: Fix tests in test_multiprocessing_spawn to use correctly CMSG_SPACE 
(GH-9613)
https://github.com/python/cpython/commit/5d33ee1595767d68800fda13bc68b7b01dba5117


--
nosy: +miss-islington

___
Python tracker 

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



[issue25095] test_httpservers hangs since Python 3.5

2018-09-28 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner
versions:  -Python 3.5

___
Python tracker 

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



[issue34521] Multiple tests (test_socket, test_multiprocessing_*) fail due to incorrect recvmsg(2) buffer lengths, causing failures on FreeBSD CURRENT

2018-09-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9018

___
Python tracker 

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



[issue34521] Multiple tests (test_socket, test_multiprocessing_*) fail due to incorrect recvmsg(2) buffer lengths, causing failures on FreeBSD CURRENT

2018-09-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9017

___
Python tracker 

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



[issue34829] Add missing selection_ methods to tkinter Spinbox

2018-09-28 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
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



[issue25095] test_httpservers hangs since Python 3.5

2018-09-28 Thread Martin Panter

Martin Panter  added the comment:

Hi William, when I mentioned “Content-Length”, I meant adding it to the 
response from the server. See the second version of “do_GET” in my earlier 
comment . But that is no good 
without also adding the “self.con.close()” line to the client I mentioned in 
two of my other comments.

In your latest rev. e6b09d4 (and earlier rev. 2022b6f) you send 
“Content-Length: 0” in a GET _request_, which doesn’t make much sense. GET 
requests never have bodies of any length. It is the “200 OK” _response_ that 
should have a body according to HTTP. The server has to shut down the 
connection or add “Content-Length: 0” (or use chunked encoding) to indicate the 
end of the body to the proxy.

So I would prefer to either adjust the “do_GET” server function as well as 
adding “self.con.close()” to the client, or just go back to rev. c1afa6b 
(“Connection: close”).

--

___
Python tracker 

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



[issue34777] urllib.request accepts anything as a header parameter for some URLs

2018-09-28 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Sure, thanks for the confirmation. Closing it as not a bug.

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



[issue34521] Multiple tests (test_socket, test_multiprocessing_*) fail due to incorrect recvmsg(2) buffer lengths, causing failures on FreeBSD CURRENT

2018-09-28 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 077061a7b24917aaf31057885c69919c5a553c88 by Victor Stinner (Pablo 
Galindo) in branch 'master':
bpo-34521: Fix tests in test_multiprocessing_spawn to use correctly CMSG_SPACE 
(GH-9613)
https://github.com/python/cpython/commit/077061a7b24917aaf31057885c69919c5a553c88


--

___
Python tracker 

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



[issue34830] functools.partial is weak referncable

2018-09-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Instances of many builtin types are not weak referencable.

>>> weakref.ref(0)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot create weak reference to 'int' object
>>> weakref.ref([])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot create weak reference to 'list' object

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue34830] functools.partial is weak referncable

2018-09-28 Thread Julien Palard


Change by Julien Palard :


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



[issue34830] functools.partial is weak referncable

2018-09-28 Thread Julien Palard


Julien Palard  added the comment:

TIL.

So it really make sense in this context to tell a functools.partial is weak 
referencable?

--

___
Python tracker 

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



[issue34830] functools.partial is weak referncable

2018-09-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I think yes.

--

___
Python tracker 

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



[issue34830] functools.partial is weak referncable

2018-09-28 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



[issue34369] kqueue.control() documentation and implementation mismatch

2018-09-28 Thread Tal Einat


Tal Einat  added the comment:

I agree Martin, I hadn't noticed that the docs don't otherwise mention the 
default behavior WRT timeout.

I've added a description as per your suggestion to the PR.

--

___
Python tracker 

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



[issue34830] functools.partial is weak referncable

2018-09-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

```

In [1]: import weakref  
  

In [2]: class A: 
   ...: __slots__ = ()  
  

In [3]: weakref.ref(A())
  
---
TypeError Traceback (most recent call last)
 in 
> 1 weakref.ref(A())

TypeError: cannot create weak reference to 'A' object

```

--
nosy: +asvetlov

___
Python tracker 

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



[issue34777] urllib.request accepts anything as a header parameter for some URLs

2018-09-28 Thread Jose Gama


Jose Gama  added the comment:

Yes, I agree, it's not a bug.This note might help other people who run into the 
same questions, particularly with error handling.Thank you!
On Friday, September 28, 2018, 7:21:03 AM GMT+2, Karthikeyan Singaravelan 
 wrote:  

Karthikeyan Singaravelan  added the comment:

Thanks for the details. Each server behaves differently for these headers which 
depends on the server configuration and using other client like curl will also 
return the same result as Python does. So I would propose closing it as not a 
bug since there is no bug with Python and it behaves like other clients do.

Thanks again for the report!

--

___
Python tracker 

___

--

___
Python tracker 

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



[issue34830] functools.partial is weak referncable

2018-09-28 Thread Julien Palard


New submission from Julien Palard :

According to the doc:

:class:`partial` objects are like :class:`function` objects in that they 
are callable, weak referencable, and can have attributes.

I don't understand why "weak" here, and it's the only occurence of "weak 
referencable" in the documentation.

I don't see an object in Python being referencable but NOT weak referencable, 
do I miss something obvious here?

--
assignee: docs@python
components: Documentation
messages: 326617
nosy: docs@python, mdk
priority: normal
severity: normal
status: open
title: functools.partial is weak referncable
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



[issue34369] kqueue.control() documentation and implementation mismatch

2018-09-28 Thread Martin Panter

Martin Panter  added the comment:

I think removing all mention of “None” is a step too far. The “devpoll”, 
“epoll”, and “poll” documentation all say that “None” is acceptable for the 
timeout. Only the “select” function doesn’t say this.

What about adding to the text:

* “timeout” in seconds (floats possible); the default is “None”, to wait forever

--

___
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-09-28 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Replacing DJBX33A's multiplier of 33 is also a different algorithm.  So is 
> working with inputs other than unsigned bytes.

I would argue that this is just extending the parameters of the algorithm. If 
the algorithm is general enough, then that shouldn't be a problem.

> So is mucking with the inputs before adding them in.

Not really. If you consider it an algorithm for hashing a sequence, that is 
just changing the input sequence.

--

___
Python tracker 

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



[issue34829] Add missing selection_ methods to tkinter Spinbox

2018-09-28 Thread Juliette Monsel


Change by Juliette Monsel :


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

___
Python tracker 

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



[issue34829] Add missing selection_ methods to tkinter Spinbox

2018-09-28 Thread Juliette Monsel


New submission from Juliette Monsel :

Though the text area of the tkinter Spinbox behaves like an Entry, the methods 
selection_from, selection_range, selection_present and selection_to have not 
been implemented. So for consistency with the Entry widget, I suggest to add 
them.

--
components: Tkinter
messages: 326614
nosy: j-4321-i
priority: normal
severity: normal
status: open
title: Add missing selection_ methods to tkinter Spinbox
type: enhancement

___
Python tracker 

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



[issue27195] Crash when RawIOBase.write(b) evaluates b.format

2018-09-28 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +9015

___
Python tracker 

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



[issue32956] python 3 round bug

2018-09-28 Thread Nathaniel Smith


Change by Nathaniel Smith :


--
nosy:  -njs

___
Python tracker 

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



[issue32956] python 3 round bug

2018-09-28 Thread Mark Dickinson

Mark Dickinson  added the comment:

> This change was advertised in the "What’s New In Python 3.0" document.

Not originally, it wasn't. That information was added later, by me. :-) [1]

In any case, I wasn't referring to documentation. I meant "silent" in the 
runtime-sense: there was no run-time error or warning associated with the 
behaviour change (in contrast to the `print` function change, for example). Few 
people read the "what's new" documents, and someone who's written Python 2 code 
using round has no particular reason to suspect a behaviour change, and no 
visible indication that such a change has occurred, when porting their code to 
Python 3. Nevertheless, their numerical results may be slightly different as a 
result of the porting. Hence the potential for late-discovered bugs.

[1] 
https://github.com/python/cpython/commit/f4112e2653f310b6e6a210c659648dbe45d3a042

--

___
Python tracker 

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