[issue33018] Improve issubclass() error checking and message

2018-03-06 Thread Joshua Bronson

New submission from Joshua Bronson :

Creating this issue by request of INADA Naoki to discuss my proposed patch in 
https://github.com/python/cpython/pull/5944.

Copy/pasting from that PR:

If you try something like issubclass('not a class', str), you get a helpful 
error message that immediately clues you in on what you did wrong:

>>> issubclass('not a class', str)
TypeError: issubclass() arg 1 must be a class
("AHA! I meant isinstance there. Thanks, friendly error message!")

But if you try this with some ABC, the error message is much less friendly!

>>> from some_library import SomeAbc
>>> issubclass('not a class', SomeAbc)
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/abc.py",
 line 230, in __subclasscheck__
cls._abc_negative_cache.add(subclass)
  File 
"/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_weakrefset.py",
 line 84, in add
self.data.add(ref(item, self._remove))
TypeError: cannot create weak reference to 'str' object

("WTF just went wrong?" Several more minutes of head-scratching ensues. Maybe a 
less experienced Python programmer who hits this hasn't seen weakrefs before 
and gets overwhelmed, maybe needlessly proceeding down a deep rabbit hole 
before realizing no knowledge of weakrefs was required to understand what they 
did wrong.)

Or how about this example:

>>> from collections import Reversible
>>> issubclass([1, 2, 3], Reversible)
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/abc.py",
 line 207, in __subclasscheck__
ok = cls.__subclasshook__(subclass)
  File 
"/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_collections_abc.py",
 line 305, in __subclasshook__
return _check_methods(C, "__reversed__", "__iter__")
  File 
"/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/_collections_abc.py",
 line 73, in _check_methods
mro = C.__mro__
AttributeError: 'list' object has no attribute '__mro__'
Here you don't even get the same type of error (AttributeError rather than 
TypeError), which seems unintentionally inconsistent.

This trivial patch fixes this, and will hopefully save untold numbers of future 
Python programmers some time and headache.

Let me know if any further changes are required, and thanks in advance for 
reviewing.

--
messages: 313376
nosy: inada.naoki, izbyshev, jab, serhiy.storchaka
priority: normal
pull_requests: 5781
severity: normal
status: open
title: Improve issubclass() error checking and message
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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread Joshua Bronson

Change by Joshua Bronson :


--
nosy: +jab

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread INADA Naoki

Change by INADA Naoki :


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



[issue30008] OpenSSL 1.1.0 deprecated functions

2018-03-06 Thread devurandom

Change by devurandom :


--
nosy: +devurandom

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread miss-islington

miss-islington  added the comment:


New changeset d824b4e4afbe9cf02310e39b14402fb2aa271f8f by Miss Islington (bot) 
in branch '3.7':
bpo-32999: Fix ABC.__subclasscheck__ crash (GH-6002)
https://github.com/python/cpython/commit/d824b4e4afbe9cf02310e39b14402fb2aa271f8f


--
nosy: +miss-islington

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread Joshua Bronson

Change by Joshua Bronson :


--
pull_requests: +5780

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5779

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset fc7df0e664198cb05cafd972f190a18ca422989c by INADA Naoki in branch 
'master':
bpo-32999: Fix ABC.__subclasscheck__ crash (GH-6002)
https://github.com/python/cpython/commit/fc7df0e664198cb05cafd972f190a18ca422989c


--

___
Python tracker 

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



[issue32969] Add more constants to zlib module

2018-03-06 Thread Xiang Zhang

Change by Xiang Zhang :


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



[issue32969] Add more constants to zlib module

2018-03-06 Thread miss-islington

miss-islington  added the comment:


New changeset 7592c0a686a80b9fbe2e6d519a486aca58b3260b by Miss Islington (bot) 
in branch '3.6':
bpo-32969: Expose some missing constants in zlib and fix the doc (GH-5988)
https://github.com/python/cpython/commit/7592c0a686a80b9fbe2e6d519a486aca58b3260b


--

___
Python tracker 

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



[issue32969] Add more constants to zlib module

2018-03-06 Thread miss-islington

miss-islington  added the comment:


New changeset c4d77a661138debbbe584b8b08410afc8719a9b1 by Miss Islington (bot) 
in branch '3.7':
bpo-32969: Expose some missing constants in zlib and fix the doc (GH-5988)
https://github.com/python/cpython/commit/c4d77a661138debbbe584b8b08410afc8719a9b1


--
nosy: +miss-islington

___
Python tracker 

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



[issue32969] Add more constants to zlib module

2018-03-06 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5778

___
Python tracker 

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



[issue32969] Add more constants to zlib module

2018-03-06 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5777

___
Python tracker 

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



[issue32969] Add more constants to zlib module

2018-03-06 Thread Xiang Zhang

Xiang Zhang  added the comment:


New changeset bc3f2289b9007396bfb7f986bee477b6176c1822 by Xiang Zhang in branch 
'master':
bpo-32969: Expose some missing constants in zlib and fix the doc (GH-5988)
https://github.com/python/cpython/commit/bc3f2289b9007396bfb7f986bee477b6176c1822


--

___
Python tracker 

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



[issue33017] Special set-cookie setting will bypass Cookielib

2018-03-06 Thread LCatro

New submission from LCatro :

PoC (PHP Version):

 header('Set-Cookie: test=123; max-age=a');  //  PoC 1
 header('Set-Cookie: test=123; domain=;');  //  PoC 2
 header('Set-Cookie: test=123; version=a;');  //  PoC 3

PoC 1 will trigger int() convert string to number from max-age 
(lib/cookielib.py:1429).I give this value a string ,it will make except 

try:
v = int(v) #  lib/cookielib.py:1429
except ValueError:
_debug("   missing or invalid (non-numeric) value for "
  "max-age attribute")
bad_cookie = True
break  #  lib/cookielib.py:1434

PoC 2 is a domain None value (lib/cookielib.py:1412).Cookielib will discard 
current cookie record.
if k == "domain":  #  lib/cookielib.py:1411
if v is None:  #  lib/cookielib.py:1412
_debug("   missing value for domain attribute")
bad_cookie = True
break  #  lib/cookielib.py:1415

PoC 3 will trigger a int() convert except(lib/cookielib.py:1472).Cookielib will 
discard current cookie record too.
version = standard.get("version", None)  #  lib/cookielib.py:1469
if version is not None:
try:
version = int(version)  #  lib/cookielib.py:1472
except ValueError:
return None  # invalid version, ignore cookie

There are PoCs involve urllib and requests library .

Full Code Analysis (Chinese Version): 
https://github.com/lcatro/Python_CookieLib_0day

--
components: Library (Lib)
files: poc.php
messages: 313370
nosy: LCatro
priority: normal
severity: normal
status: open
title: Special set-cookie setting will bypass Cookielib
versions: Python 2.7
Added file: https://bugs.python.org/file47472/poc.php

___
Python tracker 

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



[issue8840] truncate() semantics changed in 3.1.2

2018-03-06 Thread A.M. Kuchling

Change by A.M. Kuchling :


--
keywords: +patch
pull_requests: +5776

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread INADA Naoki

INADA Naoki  added the comment:

> BTW, do TypeErrors related to weak references deserve any treatment? Isn't it 
> a kind of coincidence that the error raised due to usage of WeakSet in 
> issubclass(obj, ABC) is what we expect? (Sorry, I'm not familiar with 
> WeakSets).

Sorry, I can't get what is your point.
I don't want to change ABC behavior for now.  I want to make C implementation 
consistent with Python implementation, except some (unrealistic) corner cases.

--

___
Python tracker 

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



[issue33001] Buffer overflow vulnerability in os.symlink on Windows (CVE-2018-1000117)

2018-03-06 Thread Steve Dower

Steve Dower  added the comment:

FYI, the CVE number for this issue is CVE-2018-1000117.

--
title: Buffer overflow vulnerability in os.symlink on Windows -> Buffer 
overflow vulnerability in os.symlink on Windows (CVE-2018-1000117)

___
Python tracker 

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



[issue22674] RFE: Add signal.strsignal(): string describing a signal

2018-03-06 Thread Chris Rebert

Change by Chris Rebert :


--
nosy: +cvrebert

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-06 Thread Eryk Sun

Eryk Sun  added the comment:

The inconsistent use of VOLUME_NAME_NT and VOLUME_NAME_DOS was addressed 
incidentally in issue 29734, but that issue is primarily about the handle 
leaked when GetFinalPathNameByHandleW fails. That said, you've cleanly 
addressed the handle leak in your PR also. I prefer the common cleanup approach 
that you've used here, rather than spreading the cleanup tasks around in 
blocks, where it can easily be overlooked.

The PR for issue 29734 also fixes some handle leaks related to 
win32_xstat_impl. Those leaks still need to be addressed for 3.7, and 
backported to 3.6.

--
nosy: +eryksun

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-06 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-06 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

The first call of GetFinalPathNameByHandleW requests the required buffer size 
for the NT path (VOLUME_NAME_NT), while the second call receives the DOS path 
(VOLUME_NAME_DOS) in the allocated buffer. Usually, NT paths are longer than 
DOS ones, for example:

 NT path: \Device\HarddiskVolume2\foo
DOS path: \\?\C:\foo

Or, for UNC paths:

 NT path: \Device\Mup\server\share\foo
DOS path: \\?\UNC\server\share\foo

However, it is not always the case. A volume can be mounted to an arbitrary 
path, and if a drive letter is not assigned to such a volume, 
GetFinalPathNameByHandle will use the mount point path instead of C: above. 
This way, a DOS path can be longer than an NT path. Since the result of the 
second call is not checked properly, this condition won't be detected, 
resulting in an out-of-bounds access and use of uninitialized memory later.

Moreover, the path returned by GetFinalPathNameByHandle may change between the 
first and the second call, for example, because an intermediate directory was 
renamed. If the path becomes longer than buf_size, the same issue will occur.

--
components: Extension Modules, Windows
messages: 313366
nosy: izbyshev, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: nt._getfinalpathname may use uninitialized memory
type: behavior
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



[issue33010] os.path.isdir() returns True for broken directory symlinks or junctions

2018-03-06 Thread Eryk Sun

Eryk Sun  added the comment:

Thanks for the quick feedback and pushing back on this. We just have a broken 
mount point, unlike in Unix where it's a regular directory. so you're right to 
just query the basic info for all directory reparse points, without 
special-casing mount points.

However, I do think a valid mount point is a directory. I don't see why 
os.path.ismount() returns true for a non-existent mount point, drive letter, or 
share. Is this just to avoid network access delays with unavailable mapped 
drives and shares? Also, because of the hard-coded UNC check in ismount(), we 
aren't supporting mount points in directories on shares. I think this needs 
work.

--

___
Python tracker 

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



[issue33000] IDLEX GUI consumes all RAM for scrollback buffer, uses 161Bytes / character stored

2018-03-06 Thread John Brearley

John Brearley  added the comment:

Hi Terry: The icon on my Win 7 desktop points to: "C:\WinPython\IDLEX (Python 
GUI).exe".

This was part of the 430MB installer file WinPython-64bit-3.6.4.0Qt5b4.exe from 
https://sourceforge.net/projects/winpython.

I attached a screen shot of IDLEX window & help about.

--
Added file: https://bugs.python.org/file47471/Python_IDLEX.png

___
Python tracker 

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



[issue33010] os.path.isdir() returns True for broken directory symlinks or junctions

2018-03-06 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

Hmm, actually, my NFS example is probably bad. I've run an experiment, and 
stat() simply hangs in the case if the NFS server is down.

--

___
Python tracker 

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



[issue33010] os.path.isdir() returns True for broken directory symlinks or junctions

2018-03-06 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

Thank you for the detailed response, Eryk!

> A mount point is always a directory, even if the volume isn't currently 
> available.

Do I understand correctly that you propose to additionally change 
os.path.exists() to return True for mount points with unavailable volumes? 
Сurrently, os.path.exists() (i.e, the underlying os.stat()) attempts to 
traverse them, and this would be consistent with os.path.isdir() if the latter 
were changed to traverse directory reparse points too (both would return False 
for such mount points). Is your idea to change the behavior to match POSIX in a 
similar case when, for example, the remote NFS server is down but stat() still 
works on the local mount point? If so, is this a new idea compared to the first 
paragraph of [1] where you say that non-link reparse points should always be 
traversed?

[1] https://github.com/python/cpython/pull/5998#discussion_r172402233

--

___
Python tracker 

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



[issue30235] Validate shutil supports path-like objects, update docs accordingly

2018-03-06 Thread Marco Rougeth

Change by Marco Rougeth :


--
keywords: +patch
pull_requests: +5774
stage: test needed -> patch review

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-06 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Doesn't that break when, for example, test methods are decorated with 
> unittest.mock.patch?

No, it shouldn't break them if you wrap async methods carefully.

Here's a metaclass that I wrote recently doing just that: 
https://github.com/Azure/azure-functions-python-worker/blob/9ed3f8acd45a264927ce11af64f5b495f0404032/azure/worker/testutils.py#L44-L63

--

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-06 Thread Petter S

Petter S  added the comment:

> Also, I personally subclassed TestCase in many of my projects specifically to 
> add async support.  To do that you have to use a metaclass to scan class' 
> namespace for 'async def' functions.

Doesn't that break when, for example, test methods are decorated with 
unittest.mock.patch?

--

___
Python tracker 

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



[issue29623] configparser.ConfigParser.read() does not accept Pathlib path as a single argument.

2018-03-06 Thread Berker Peksag

Change by Berker Peksag :


--
pull_requests:  -966

___
Python tracker 

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



[issue29623] configparser.ConfigParser.read() does not accept Pathlib path as a single argument.

2018-03-06 Thread Berker Peksag

Change by Berker Peksag :


--
pull_requests:  -594

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-06 Thread Yury Selivanov

Yury Selivanov  added the comment:

> How is a separate base class better? :)

It's very explicit that way.

Also, I personally subclassed TestCase in many of my projects specifically to 
add async support.  To do that you have to use a metaclass to scan class' 
namespace for 'async def' functions.

Currently, unittest.TestCase doesn't have a metaclass.  If you add one to it, 
it might break all packages that were subclassing TestCase with a metaclass.


> If you accidentally add `async` to the front of a test method in a 
> TestCase-derived test class, you get mostly-silent success with an 
> easily-ignored warning about a coroutine not being awaited.

Well, what if you use trio or curio?  You add an 'async' keyword and get a 
cryptic error that some framework internals just broke.

So I'm strong -1 on the coroutine_runner attribute idea.

--

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-06 Thread Petter S

Petter S  added the comment:

It's good to see others with the same idea as me. I just wrote 
https://github.com/python/cpython/pull/6005/commits/4d7e1837f235687c875e985e97701609fc1ac458
 .

In my opinion, there is no need for another test class. I completely agree with 
Zachary Ware that the current TestCase class is more or less broken (or at 
least easily misused) with respect to coroutines.

Fixing TestCase would not break existing code. The customization of event loop 
would not be hard to add.

--
nosy: +Petter S

___
Python tracker 

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



[issue33015] Fix function cast warning in thread_pthread.h

2018-03-06 Thread Siddhesh Poyarekar

Change by Siddhesh Poyarekar :


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

___
Python tracker 

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



[issue33015] Fix function cast warning in thread_pthread.h

2018-03-06 Thread Siddhesh Poyarekar

New submission from Siddhesh Poyarekar :

The PyThread_start_new_thread function takes a void (*)(void *) as the function 
argument, which does not match with the pthread_create callback which has type 
void *(*)(void *).  I've got a fix for this that adds a wrapper function of the 
right type that subsequently calls the function passed to 
PyThread_start_new_thread.

PR coming up.

--
components: Build
messages: 313357
nosy: siddhesh
priority: normal
severity: normal
status: open
title: Fix function cast warning in thread_pthread.h
type: compile error

___
Python tracker 

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread Yury Selivanov

Change by Yury Selivanov :


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

___
Python tracker 

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread miss-islington

miss-islington  added the comment:


New changeset 387a055261267f5fafd2c12eafef49759c94704f by Miss Islington (bot) 
in branch '3.6':
bpo-33009: Fix inspect.signature() for single-parameter partialmethods. 
(GH-6004)
https://github.com/python/cpython/commit/387a055261267f5fafd2c12eafef49759c94704f


--

___
Python tracker 

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



[issue33010] os.path.isdir() returns True for broken directory symlinks or junctions

2018-03-06 Thread Eryk Sun

Eryk Sun  added the comment:

Yes, it makes sense to call GetFileAttributes as the fast path, and then fall 
back on a slow path (i.e. create, query, close) for a directory reparse point. 
With GetFileInformationByHandleEx, the equivalent query is FileBasicInfo, which 
is available starting with Vista, so this could be backported to 3.5 if 
necessary. 

However, to be more consistent with POSIX, we need to first query 
FileAttributeTagInfo on the reparse point to get the reparse tag. If it's 
IO_REPARSE_TAG_MOUNT_POINT (junction) and the target is a volume name (i.e. 
"Volume{GUID}"), then we should return true. This can also be checked via 
GetVolumePathName, after normalizing the path, like how os.path.ismount() works 
on Windows (ntpath.py). A mount point is always a directory, even if the volume 
isn't currently available. OTOH, sometimes junctions are used as links instead, 
which is being addressed more generally by Vidar Fauske in issue 31226. There's 
potentially overlap here with Vidar's proposed _Py_is_reparse_link function.

More info on GetFileAttributes, if you're curious:

GetFileAttributes and GetFileAttributesEx are relatively cheap I/O calls. 
They're implemented by translating to a native NT path and calling 
NtQueryAttributesFile and NtQueryFullAttributesFile, respectively. These two 
system calls are optimized for network access. They use an open packet that 
that's query-only without reparsing. The I/O Manager's parse routine can thus 
use a local (fake) File object, the file system's corresponding fast I/O 
routine, and skip the normal cruft of working with an I/O request (i.e. 
IRP_MJ_CREATE, IRP_MJ_QUERY_INFORMATION, IRP_MJ_CLEANUP, and IRP_MJ_CLOSE). In 
the sample fastfat driver, these routines are respectively 
FatFastQueryBasicInfo [1] and FatFastQueryNetworkOpenInfo [2].

[1]: 
https://github.com/Microsoft/Windows-driver-samples/blob/aa6e0b36eb932099fa4eb950a6f5e289a23b6d6e/filesys/fastfat/fatdata.c#L933

[2]: 
https://github.com/Microsoft/Windows-driver-samples/blob/aa6e0b36eb932099fa4eb950a6f5e289a23b6d6e/filesys/fastfat/fatdata.c#L1272

--

___
Python tracker 

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread miss-islington

miss-islington  added the comment:


New changeset 112f799666bac1bdbb320840d5fda3132255eb5e by Miss Islington (bot) 
in branch '3.7':
bpo-33009: Fix inspect.signature() for single-parameter partialmethods. 
(GH-6004)
https://github.com/python/cpython/commit/112f799666bac1bdbb320840d5fda3132255eb5e


--
nosy: +miss-islington

___
Python tracker 

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



[issue4173] PDF documentation: long verbatim lines are cut off at right hand side

2018-03-06 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

I just tested the PDF on the current version of the docs and this is no longer 
an issue.  The original example given wraps correctly on the PDF output.

--
nosy: +csabella
resolution:  -> works for me
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



[issue32972] unittest.TestCase coroutine support

2018-03-06 Thread Zachary Ware

Zachary Ware  added the comment:

How is a separate base class better? :)

Having a default coroutine runner on the standard TestCase means all you have 
to do to add async tests is tack an `async` onto the front of your method 
definition, and everything just works as it always has.  Making it a separate 
base class means you have to know about that base class, what it's called, and 
remember to derive your test class from it.  If you accidentally add `async` to 
the front of a test method in a TestCase-derived test class, you get 
mostly-silent success with an easily-ignored warning about a coroutine not 
being awaited.

--

___
Python tracker 

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



[issue32388] Remove cross-version binary compatibility

2018-03-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Yes, let's retarget to 3.8.

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



[issue32972] unittest.TestCase coroutine support

2018-03-06 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Instead of a separate base class, what about an overridable 
> `coroutine_runner` attribute that defaults to `asyncio.run`?

How is that better?

--

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-06 Thread Zachary Ware

Zachary Ware  added the comment:

Instead of a separate base class, what about an overridable `coroutine_runner` 
attribute that defaults to `asyncio.run`?

--
nosy: +zach.ware

___
Python tracker 

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



[issue33000] IDLEX GUI consumes all RAM for scrollback buffer, uses 161Bytes / character stored

2018-03-06 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I did not close either window before looking at the Task Manager number.

Once your program is debugged, I cannot think of any advantage of running it 
through IDLE instead of directly with the Python interpreter.

Since you repeat 'IDLEX' I still do not know whether you are running IDLEX or 
IDLE itself.

--

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-06 Thread Yury Selivanov

Yury Selivanov  added the comment:

I think the right approach would be to add an new base TestCase class: 
AsyncioTestCase.  There other frameworks that have different event loop 
implementations, so we can't assume that an `async def` test should always be 
executed by asyncio.

And you should use the `asyncio.run` function to run the coroutine.

--

___
Python tracker 

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



[issue32992] unittest: Automatically run coroutines in a loop

2018-03-06 Thread Yury Selivanov

Yury Selivanov  added the comment:

This is a duplicate of issue 32972. Let's move the discussion there.

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> unittest.TestCase coroutine support

___
Python tracker 

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5772

___
Python tracker 

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 8a387219bdfb6ee34928d6168ac42ca559f11c9a by Yury Selivanov in 
branch 'master':
bpo-33009: Fix inspect.signature() for single-parameter partialmethods. 
(GH-6004)
https://github.com/python/cpython/commit/8a387219bdfb6ee34928d6168ac42ca559f11c9a


--

___
Python tracker 

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5771

___
Python tracker 

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



[issue32992] unittest: Automatically run coroutines in a loop

2018-03-06 Thread Yury Selivanov

Yury Selivanov  added the comment:

I think the right approach would be to add an new base TestCase class: 
AsyncioTestCase.

And you should use the `asyncio.run` function to run the coroutine.

--
nosy: +yselivanov

___
Python tracker 

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



[issue32992] unittest: Automatically run coroutines in a loop

2018-03-06 Thread Petter S

Change by Petter S :


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

___
Python tracker 

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



[issue31349] Embedded initialization ignores Py_SetProgramName()

2018-03-06 Thread Steve Dower

Steve Dower  added the comment:

(That said, I didn't try again 3.7, so it may already be fixed there. But since 
we're still fixing problems with 3.6, we should do that one too.)

--

___
Python tracker 

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



[issue31349] Embedded initialization ignores Py_SetProgramName()

2018-03-06 Thread Steve Dower

Steve Dower  added the comment:

I just hit this myself (and embarrassingly, I recently touched this code 
everyone and forgot to fix this).

Hopefully I get a chance to get to it, but patches are certainly welcome and 
I'll happily aim to get them into 3.6 onwards.

--
versions: +Python 3.6, Python 3.8

___
Python tracker 

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



[issue33011] Embedded 3.6.4 distribution does not add script parent as sys.path[0]

2018-03-06 Thread Steve Dower

Steve Dower  added the comment:

This is the intentional design of the embedded distribution. You need to update 
the ._pth file to include the directories that have files that are part of your 
app - it's not meant for running random scripts, that's the job of the normal 
distribution.

The build script files are in Tools/msi with the other installer files, 
primarily make_zip.py, though that also gets used for the Nuget packages.

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread Yury Selivanov

Yury Selivanov  added the comment:

Yeah, that assertion needs to be tweaked a little bit.  Created a PR.

--

___
Python tracker 

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread Yury Selivanov

Change by Yury Selivanov :


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



[issue33013] Underscore in str.format with x option

2018-03-06 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Thanks guys.

I really thought I tried '{0:_x}'.format(123456789), but I guess I hadn't.  
Good to know that using format(123456879, '_x) is better.

--

___
Python tracker 

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



[issue33014] Clarify doc string for str.isidentifier()

2018-03-06 Thread Sanyam Khurana

Sanyam Khurana  added the comment:

Hey David,

I'm working on this issue. Will submit a PR in a while :)

--
nosy: +CuriousLearner

___
Python tracker 

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



[issue32642] add support for path-like objects in sys.path

2018-03-06 Thread Brett Cannon

Brett Cannon  added the comment:

'make regen-all' should do it (but so will just running 'make -s -j' like
any old build of CPython).

On Mon, Mar 5, 2018, 12:43 Jay Yin,  wrote:

>
> Jay Yin  added the comment:
>
> I'm unsure how to regenerate the files that interact with the code for
> sys.path as travisCI states
> "
> Generated files not up to date
>  M Python/importlib_external.h
> "
> since my code changes some of how the importing is handled
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue32991] AttributeError in doctest.DocTestFinder.find

2018-03-06 Thread Jason R. Coombs

Change by Jason R. Coombs :


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



[issue33013] Underscore in str.format with x option

2018-03-06 Thread Eric V. Smith

Eric V. Smith  added the comment:

The format specifier (here, 'x') always goes last.

>>> '{0:_x}'.format(123456789)
'75b_cd15'

See https://docs.python.org/3/library/string.html#formatstrings for the details.

Serhiy is correct that it's often easier to use format() instead of ''.format() 
for testing things like this.

--
nosy: +eric.smith

___
Python tracker 

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



[issue33014] Clarify doc string for str.isidentifier()

2018-03-06 Thread David Beazley

New submission from David Beazley :

This is a minor nit, but the doc string for str.isidentifier() states:

Use keyword.iskeyword() to test for reserved identifiers such as "def" and 
"class".

At first glance, I thought that it meant you'd do this (doesn't work):

'def'.iskeyword()

As opposed to this:

import keyword
keyword.iskeyword('def')

Perhaps a clarification that "keyword" refers to the keyword module could be 
added.   Or better yet, just make 'iskeyword()` a string method ;-).

--
assignee: docs@python
components: Documentation
messages: 313335
nosy: dabeaz, docs@python
priority: normal
severity: normal
status: open
title: Clarify doc string for str.isidentifier()
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



[issue33013] Underscore in str.format with x option

2018-03-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

>>> format(123456789, '_x')
'75b_cd15'

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Could you please show examples with __suclasscheck__ returning True for 
non-class objects?

--

___
Python tracker 

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



[issue32991] AttributeError in doctest.DocTestFinder.find

2018-03-06 Thread Jason R. Coombs

Jason R. Coombs  added the comment:


New changeset 5a0c3987abd6a71b4fadeb525477eb5f560e8514 by Jason R. Coombs (Miss 
Islington (bot)) in branch '3.7':
bpo-32991: Restore expectation that inspect.getfile raises TypeError on 
namespace package (GH-5980) (GH-5997)
https://github.com/python/cpython/commit/5a0c3987abd6a71b4fadeb525477eb5f560e8514


--

___
Python tracker 

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



[issue20150] API change in string formatting with :s option should be documented in What's New.

2018-03-06 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

I believe this has been added to the 3.4 What's New already:

object.__format__() no longer accepts non-empty format strings, it now raises a 
TypeError instead. Using a non-empty string has been deprecated since Python 
3.2. This change has been made to prevent a situation where previously working 
(but incorrect) code would start failing if an object gained a __format__ 
method, which means that your code may now raise a TypeError if you are using 
an 's' format code with objects that do not have a __format__ method that 
handles it. See bpo-7994 for background

Closing as resolved.

--
nosy: +csabella
resolution:  -> fixed
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



[issue33013] Underscore in str.format with x option

2018-03-06 Thread Cheryl Sabella

New submission from Cheryl Sabella :

>From the doc 
>(https://docs.python.org/3/library/string.html#format-specification-mini-language):

> The '_' option signals the use of an underscore for a thousands separator for 
> floating point presentation types and for integer presentation type 'd'. For 
> integer presentation types 'b', 'o', 'x', and 'X', underscores will be 
> inserted every 4 digits. For other presentation types, specifying this option 
> is an error.

>>> '{0:_}'.format(123456789)
'123_456_789'
>>> '{0:x}'.format(123456789)
'75bcd15'
>>> '{0:x_}'.format(123456789)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Invalid format specifier

What am I doing wrong?  I read the doc as saying that using `type` of `x` would 
result in the `_` separator to be inserted every 4 characters, so I was 
expecting the output to be '75b_cd15'.

Thanks!

--
messages: 313330
nosy: csabella
priority: normal
severity: normal
status: open
title: Underscore in str.format with x option
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue33005] 3.7.0b2 Interpreter crash in dev mode (or with PYTHONMALLOC=debug) with 'python -X dev -c 'import os; os.fork()'

2018-03-06 Thread STINNER Victor

STINNER Victor  added the comment:

> Thank you! I can confirm that git commit 
> 31e2b76f7bbcb8278748565252767a8b7790ff27 on the 3.7 branch fixes the issue 
> for me.

Cool. You can now continue your gevent tests using -X dev ;-)

--

___
Python tracker 

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



[issue33005] 3.7.0b2 Interpreter crash in dev mode (or with PYTHONMALLOC=debug) with 'python -X dev -c 'import os; os.fork()'

2018-03-06 Thread Jason Madden

Jason Madden  added the comment:

Thank you! I can confirm that git commit 
31e2b76f7bbcb8278748565252767a8b7790ff27 on the 3.7 branch fixes the issue for 
me.

--

___
Python tracker 

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



[issue33000] IDLEX GUI consumes all RAM for scrollback buffer, uses 161Bytes / character stored

2018-03-06 Thread John Brearley

John Brearley  added the comment:

Hi Terry: I am exploring the value of a language specific editor and runtime 
environment. Its definitely a large step up from Windows Notepad and Gnome 
Gedit. Perhaps some notes in the IDLEX documentation regarding the development 
versus production runtime usages would be in order?

Perhaps in your Win10 environment you get the memory back when you close the 
shell window. In Win7, you dont get the memory back until you close both 
windows.

--

___
Python tracker 

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



[issue33008] urllib.request.parse_http_list incorrectly strips backslashes

2018-03-06 Thread Ned Deily

Change by Ned Deily :


--
nosy: +barry, orsenthil, r.david.murray

___
Python tracker 

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



[issue33005] 3.7.0b2 Interpreter crash in dev mode (or with PYTHONMALLOC=debug) with 'python -X dev -c 'import os; os.fork()'

2018-03-06 Thread STINNER Victor

STINNER Victor  added the comment:

Thanks Jason Madden for your bug report! I should now be fixed.

You might want to try the 3.7 or master branch until the next 3.7 release: PEP 
537 ("3.7.0 beta 3: 2018-03-26").

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue33005] 3.7.0b2 Interpreter crash in dev mode (or with PYTHONMALLOC=debug) with 'python -X dev -c 'import os; os.fork()'

2018-03-06 Thread miss-islington

miss-islington  added the comment:


New changeset 31e2b76f7bbcb8278748565252767a8b7790ff27 by Miss Islington (bot) 
in branch '3.7':
bpo-33005: Fix _PyGILState_Reinit() (GH-6001)
https://github.com/python/cpython/commit/31e2b76f7bbcb8278748565252767a8b7790ff27


--
nosy: +miss-islington

___
Python tracker 

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



[issue33005] 3.7.0b2 Interpreter crash in dev mode (or with PYTHONMALLOC=debug) with 'python -X dev -c 'import os; os.fork()'

2018-03-06 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5768

___
Python tracker 

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



[issue33005] 3.7.0b2 Interpreter crash in dev mode (or with PYTHONMALLOC=debug) with 'python -X dev -c 'import os; os.fork()'

2018-03-06 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 5d92647102fac9e116b98ab8bbc632eeed501c34 by Victor Stinner in 
branch 'master':
bpo-33005: Fix _PyGILState_Reinit() (#6001)
https://github.com/python/cpython/commit/5d92647102fac9e116b98ab8bbc632eeed501c34


--

___
Python tracker 

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



[issue32958] socket module calls with long host names can fail with idna codec error

2018-03-06 Thread Matt Eaton

Matt Eaton  added the comment:

Using Ubuntu 16.04 with the 3.6.0 tag I was also able to reproduce the same 
error reported:

import socket

h = 
"0123456789012345678901234567890123456789012345678901234567890123.example.com"
socket.gethostbyname(h)

Traceback (most recent call last):
  File 
"/home/agnosticdev/Documents/code/python/python-dev/cpython-3_6_0/Lib/encodings/idna.py",
 line 165, in encode
raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "host_test.py", line 8, in 
socket.gethostbyname(h)
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or 
too long)


It looks like the hostname being 64 characters long is the issue in that it 
cannot be encoded.  Thus falling into the UnicodeError being raised in idna.py:
# ASCII name: fast path
labels = result.split(b'.')
for label in labels[:-1]:
if not (0 < len(label) < 64):
raise UnicodeError("label empty or too long")
if len(labels[-1]) >= 64:
raise UnicodeError("label too long")
return result, len(input)

I did some work on this to try and resolve this, but ultimately it was not 
worth committing so I wanted to report my findings.

--
nosy: +agnosticdev

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

OK, making a new implementation behave as the old one is fine with me too.

BTW, do TypeErrors related to weak references deserve any treatment? Isn't it a 
kind of coincidence that the error raised due to usage of WeakSet in 
issubclass(obj, ABC) is what we expect? (Sorry, I'm not familiar with WeakSets).

--

___
Python tracker 

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Actually, the behaviour when __suclasscheck__ returns True for non-class 
objects may be used by some code. Even typing module did this, I tried to 
remove as much as possible of this, but I think there may be few such 
situations left.

Therefore, the patch by Inada-san (that makes C behaviour follow Python 
behaviour) looks reasonable to me.

--

___
Python tracker 

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



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-06 Thread Charalampos Stratakis

Charalampos Stratakis  added the comment:

We are getting hit by that quite often on Fedora, with the transition to gcc 8 
and it creates unnecessary noise at our build logs. Thanks for working on that.

When you sent your PR I can test it within our build system and verify if it 
works.

--
nosy: +cstratak

___
Python tracker 

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



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Argument Clinic generates the following declaration for the second parameter of 
METH_NOARGS functions:

PyObject *Py_UNUSED(ignored)

It would be nice to follow the same style.

If the first parameter is of type PyObject* too, the explicit cast to 
PyCFunction can be removed.

Skip the curses module. It will be converted to Argument Clinic.

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



[issue32999] issubclass(obj, abc.ABC) causes a segfault

2018-03-06 Thread INADA Naoki

Change by INADA Naoki :


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

___
Python tracker 

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



[issue33005] 3.7.0b2 Interpreter crash in dev mode (or with PYTHONMALLOC=debug) with 'python -X dev -c 'import os; os.fork()'

2018-03-06 Thread STINNER Victor

STINNER Victor  added the comment:

This bug is likely a regression on my work on Py_Main(): see bpo-32030. I 
proposed a fix: see attached PR 6001.

--

___
Python tracker 

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



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-06 Thread Siddhesh Poyarekar

New submission from Siddhesh Poyarekar :

gcc 8 has added a new warning heuristic to detect invalid function casts and a 
stock python build seems to hit that warning quite often.  The most common is 
the cast of a METH_NOARGS function (that uses just one argument) to a 
PyCFunction.  The fix is pretty simple but needs to be applied widely.  I'm 
slowly knocking them off in my spare time; WIP here, which has a few other 
types of warnings mixed in that I'll sift out during submission and also create 
separate bug reports for:

https://github.com/siddhesh/cpython/tree/func-cast

I'll clean up and post PR(s) once I am done but I figured I should file this 
report first since it is a pretty big change in terms of number of files 
touched and wanted to be sure that I'm making changes the way the community 
prefers.

--
components: Build
messages: 313317
nosy: siddhesh
priority: normal
severity: normal
status: open
title: Invalid function cast warnings with gcc 8 for METH_NOARGS
type: compile error

___
Python tracker 

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



[issue33005] 3.7.0b2 Interpreter crash in dev mode (or with PYTHONMALLOC=debug) with 'python -X dev -c 'import os; os.fork()'

2018-03-06 Thread STINNER Victor

Change by STINNER Victor :


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

___
Python tracker 

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



[issue33011] Embedded 3.6.4 distribution does not add script parent as sys.path[0]

2018-03-06 Thread Cong Monkey

Change by Cong Monkey :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
type:  -> behavior

___
Python tracker 

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



[issue33011] Embedded 3.6.4 distribution does not add script parent as sys.path[0]

2018-03-06 Thread Cong Monkey

New submission from Cong Monkey :

Embedded 3.6.0 distribution does not insert script parent in sys.path[0], but 
the normal python do it.

this make some failed, like when I try to do pip install future, it will failed 
as import src.future failed, which works for normal python.

The root source maybe when python36._pth exist, python rewrite the flag and 
mark as isolate mode automate, which will not update sys.path when 
pymain_init_sys_path.

I use a trick which is really bad as a work around(and even when site .main the 
sys.argv is not ready!), and hope upstream will fix the root source.

===begin in my usercustomize.py:
import sys

import pathlib



class DummyImportHook(object):

def __init__(self, *args):

self.is_script_path_to_sys_path_be_done = False

pass


def find_module(self, fullname, path=None):

# print(f'{DummyImportHook.__name__} trigger {sys.argv if hasattr(sys, 
"argv") else ""} ')

if not self.is_script_path_to_sys_path_be_done and hasattr(sys, 'argv'):

if sys.argv[0] is not None:

# print(f'{DummyImportHook.__name__}:argv is {sys.argv}')

path_obj = pathlib.Path(sys.argv[0])

# #if path_obj.exists():

# print(f'{DummyImportHook.__name__}:I am try to add 
{str(path_obj.parent)} to sys.path')

sys.path.insert(0, str(path_obj.parent))

print(f'{DummyImportHook.__name__}:current sys.path is 
{sys.path}')

pass

self.is_script_path_to_sys_path_be_done = True

pass

return None

pass



print(f'{DummyImportHook.__name__}:auto script path to sys.path hook load!')



#sys.meta_path = [DummyImportHook()]

sys.meta_path.insert(0,DummyImportHook())


===end in my usercustomize.py:
===begin in my python36._pth
python36
.
# Uncomment to run site.main() automatically
import site
===end in my python36._pth

BTW, where is Embedded distribution package script in python git repo?

--
messages: 313316
nosy: Cong Monkey
priority: normal
severity: normal
status: open
title: Embedded 3.6.4 distribution does not add script parent as sys.path[0]
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



[issue32911] Doc strings no longer stored in body of AST

2018-03-06 Thread INADA Naoki

INADA Naoki  added the comment:

There are no enough +1 for merging GH-5927 yet on the ML discussion.
https://mail.python.org/pipermail/python-dev/2018-February/152311.html

@Mark.Shannon, would you comment your opinion to the ML thread?

For now, I don't want to break tools supporting Python 3.7 a1~b2 already.
Although I will select (2) if there is time machine...

--

___
Python tracker 

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



[issue33010] os.path.isdir() returns True for broken directory symlinks or junctions

2018-03-06 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

os.path.isdir() violates its own documentation by returning True for broken 
directory symlinks or junctions, for which os.path.exists() returns False:

>>> os.mkdir('b')
>>> import _winapi
>>> _winapi.CreateJunction('b', 'a')
>>> os.rmdir('b')
>>> os.path.exists('a')
False
>>> os.path.isdir('a')
True

The underlying problem is that os.path.isdir() uses GetFileAttributes, which is 
documented not to follow symlinks.

Eryk, is there a cheaper way to check FILE_ATTRIBUTE_DIRECTORY on a path while 
following reparse points apart from 
CreateFile/GetFileInformationByHandleEx/CloseFile?

Also, does it make sense to use GetFileAttributes as a fast path and use 
something like above as a fallback only if FILE_ATTRIBUTE_REPARSE_POINT is set, 
or does GetFileAttributes do something equivalently expensive under the hood?

--
components: Extension Modules, Windows
messages: 313314
nosy: eryksun, izbyshev, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.path.isdir() returns True for broken directory symlinks or junctions
type: behavior
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



[issue29708] support reproducible Python builds

2018-03-06 Thread Alexandru Ardelean

Alexandru Ardelean  added the comment:

Yeah, I also see it with 3.6.4.
I wanted to try 3.7 to see if it's fixed by chance.

Otherwise I may have to start digging deep into compilation logic.

Looking here:
https://tests.reproducible-builds.org/lede/lede_ar71xx.html

More specifically here:
https://tests.reproducible-builds.org/lede/dbd/packages/mips_24kc/packages/python3-asyncio_3.6.4-5_mips_24kc.ipk.html
it looks like 2 byte-codes are inverted

build1: 
7f80:​·​0100·​003e·​0200·​·​72b6·​·​0072·​b500·​·​.​.​.​>.​.​.​.​r.​.​.​.​r.​.​
build2: 
7f80:​·​0100·​003e·​0200·​·​72b5·​·​0072·​b600·​·​.​.​.​>.​.​.​.​r.​.​.​.​r.​.​

72b6 and 72b5 like to swap positions sometimes.

--

___
Python tracker 

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



[issue29708] support reproducible Python builds

2018-03-06 Thread Will Thompson

Will Thompson  added the comment:

For what it's worth, in Endless OS we still saw slight variations between 
builds in the .pyc files, even with all the source files' mtimes set to the 
epoch (ie. equivalent to setting & supporting SOURCE_DATE_EPOCH, I believe). 
Looking at the contents of the file suggested it was just reordering of class 
fields; indeed, we only saw this on Python versions where hash randomization is 
enabled by default, and disabling hash randomization made the output 
reproducible.

--
nosy: +Will Thompson

___
Python tracker 

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



[issue33002] Making a class formattable as hex/oct integer with printf-style formatting requires both __int__ and __index__ for no good reason

2018-03-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

Agreed that this seems wrong.

--
nosy: +eric.smith, mark.dickinson

___
Python tracker 

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



[issue33009] Assertion failure in inspect.signature on unbound partialmethods

2018-03-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This is not a crash, but an assertion failure.

The assertion was added in issue30149.

--
nosy: +serhiy.storchaka, yselivanov
stage:  -> needs patch
title: inspect.signature crashes on unbound partialmethods -> Assertion failure 
in inspect.signature on unbound partialmethods
type:  -> behavior
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