[issue35568] Expose the C raise() function in the signal module, for use on Windows

2018-12-22 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

Vladimir Matveev pointed out that there's already a wrapper in 
_testcapimodule.c: 
https://github.com/python/cpython/blob/f06fba5965b4265c42291d10454f387b76111f26/Modules/_testcapimodule.c#L3862-L3879

So if we do add this to signalmodule.c, we can drop that.

--

___
Python tracker 

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



[issue35568] Expose the C raise() function in the signal module, for use on Windows

2018-12-22 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

It probably doesn't matter too much either way, but almost all the 
signal-related wrappers are in signal. os.kill is the only exception AFAIK.

--

___
Python tracker 

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



[issue33661] urllib may leak sensitive HTTP headers to a third-party web site

2018-12-22 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



[issue35568] Expose the C raise() function in the signal module, for use on Windows

2018-12-22 Thread Steve Dower


Steve Dower  added the comment:

Sounds fine to me.

Any particular reason to put it in signal rather than os/posixmodule? If it's 
just to avoid treating os/posixmodule like a dumping ground for C89/POSIX 
APIs... well... too late :) I say keep dumping them there. But I don't have a 
strong opinion about this, and would approve a PR to either location.

--

___
Python tracker 

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



[issue35568] Expose the C raise() function in the signal module, for use on Windows

2018-12-22 Thread Nathaniel Smith


New submission from Nathaniel Smith :

Suppose we want to test how a program responds to control-C. We'll want to 
write a test that delivers a SIGINT to our process at a time of our choosing, 
and then checks what happens. For example, asyncio and Trio both have tests 
like this, and Trio even does a similar thing at run-time to avoid dropping 
signals in an edge case [1].

So, how can we deliver a signal to our process?

On POSIX platforms, you can use `os.kill(os.getpid(), signal.SIGINT)`, and that 
works fine. But on Windows, things are much more complicated: 
https://github.com/python/cpython/pull/11274#issuecomment-449543725

The simplest solution is to use the raise() function. On POSIX, raise(signum) 
is just a shorthand for kill(getpid(), signum). But, that's only on POSIX. On 
Windows, kill() doesn't even exist... but raise() does. In fact raise() is 
specified in C89, so *every* C runtime has to provide raise(), no matter what 
OS it runs on.

So, you might think, that's ok, if we need to generate synthetic signals on 
Windows then we'll just use ctypes/cffi to access raise(). *But*, Windows has 
multiple C runtime libraries (for example: regular and debug), and you have to 
load raise() from the same library that Python is linked against. And I don't 
know of any way for a Python script to figure out which runtime it's linked 
against. (I know how to detect whether the interpreter is configured in debug 
mode, but that's not necessarily the same as being linked against the debug 
CRT.) So on the one platform where you really need to use raise(), there's 
AFAICT no reliable way to get access to it.

This would all be much simpler if the signal module wrapped the raise() 
function, so that we could just do 'signal.raise_(signal.SIGINT)'. We should do 
that.

---

[1] Specifically, consider the following case (I'll use asyncio terminology for 
simplicity): (1) the user calls loop.add_signal_handler(...) to register a 
custom signal handler. (2) a signal arrives, and is written to the wakeup pipe. 
(3) but, before the loop reads the wakeup pipe, the user calls 
loop.remove_signal_handler(...) to remove the custom handler and restore the 
original signal settings. (4) now the loop reads the wakeup pipe, and discovers 
that a signal has arrived, that it no longer knows how to handle. Now what? In 
this case trio uses raise() to redeliver the signal, so that the new signal 
handler has a chance to run.

--
messages: 332382
nosy: njs, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Expose the C raise() function in the signal module, for use on Windows
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



[issue35565] Add detail to an assertion failure message in wsgiref

2018-12-22 Thread Cheryl Sabella


Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue33661] urllib may leak sensitive HTTP headers to a third-party web site

2018-12-22 Thread Katsuhiko YOSHIDA


Katsuhiko YOSHIDA  added the comment:

Hi,

I agree with this suggestion.

First, section 6.4. "Redirection 3xx" of RFC 7231 doesn't explicitly explain 
whether to send all headers (including Authorization).

I have confirmed that some third-party-library, tool, Programing Language and 
web browser did NOT forward the Authorization header at redirect.

- urllib3 (after 1.23, PR: https://github.com/urllib3/urllib3/pull/1346)
- curl (after 7.58.0, ref: https://curl.haxx.se/docs/CVE-2018-107.html)
- net/http package of Golang (ref: 
https://github.com/golang/go/blob/release-branch.go1.11/src/net/http/client.go#L41-L46)
- Safari Version 12.0.2 (13606.3.4.1.4)
- Google Chrome Version 71.0.3578.98 (Official Build) (64-bit)

In other words, these are being on the safe side.

Actually, HTTPBasicAuthHandler of urllib2 doesn't forward the Authorization 
header at redirect. If this suggestion is rejected, I think that it should be 
changed.

--
keywords: +patch
nosy: +kyoshidajp
pull_requests: +10522
stage:  -> patch review

___
Python tracker 

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



[issue35566] DOC: Add links to annotation glossary term

2018-12-22 Thread Cheryl Sabella


Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue35567] Convert membership test from dict-of-constants to a set

2018-12-22 Thread Raymond Hettinger


New submission from Raymond Hettinger :

On line 164 in Lib/wsgiref/utils.py, there is a dictionary called *_hoppish* 
that should be a set object.

--
assignee: cheryl.sabella
components: Library (Lib)
keywords: easy
messages: 332380
nosy: cheryl.sabella, rhettinger
priority: normal
severity: normal
status: open
title: Convert membership test from dict-of-constants to a set
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



[issue35566] DOC: Add links to annotation glossary term

2018-12-22 Thread Cheryl Sabella


New submission from Cheryl Sabella :

Add links to glossary term when `annotation` is used.

--
assignee: docs@python
components: Documentation
messages: 332379
nosy: cheryl.sabella, docs@python
priority: normal
severity: normal
status: open
title: DOC: Add links to annotation glossary term
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



[issue35565] Add detail to an assertion failure message in wsgiref

2018-12-22 Thread Raymond Hettinger


New submission from Raymond Hettinger :

On line 236 in Lib/wsgiref/handlers.py, we get the assertion message, 
"Hop-by-hop headers not allowed".   

That message should should show the *name* and *value* that triggered the 
failure.  Otherwise, it is difficult to know which header caused the problem 
(in my case, it was Connection: close).

--
assignee: cheryl.sabella
components: Library (Lib)
keywords: easy
messages: 332378
nosy: cheryl.sabella, rhettinger
priority: normal
severity: normal
status: open
title: Add detail to an assertion failure message in wsgiref
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



[issue35557] Allow lowercase hexadecimal characters in base64.b16decode()

2018-12-22 Thread Dylan Houlihan


Dylan Houlihan  added the comment:

Karthikeyan,

Thank you for taking the time to respond so thoroughly. In particular, in the 
future I'll be more careful to qualify and quantify potential performance 
improvements using `timeit` or `perf`.

That being said, as I mentioned the primary motivation for this is not a 
performance improvement - I just felt that was a nice potential side effect. 
Rather, this enhancement brings `base64.b16decode` into behavioral consistency 
with `binascii.unhexlify`. The `binascii` method already accepts both uppercase 
and lowercase hexadecimal characters by default.

However I can definitely understand what you and Serhiy are saying about this 
being a breaking change. Therefore I'd like to amend my proposal to the 
following:

1. Keep the `casefold` argument and corresponding logic, but keep the revised 
regex that will match against both uppercase and lowercase characters; and

2. Only put this change in for Python 3.8, this way existing code which uses 
the explicit argument on versions <= 3.7 does not break (but will still 
function normally).

I've altered this issue to reflect my amended proposal, targeting only version 
3.8 and editing the type to be behavior instead of performance. In this way, 
the change will still make `base64.b16decode` consistent with 
`binascii.unhexlify` (and the case insensitivity of hexadecimal encoding more 
generally) without breaking existing code or requiring developers to change 
workflows using `casefold`.

Naturally there would be additional logic that *enforces* the case sensitivity 
if `casefold=false` is passed to the method, and this will likewise not break 
existing workflows either. 

If this change is considered agreeable, I will amend my open pull request to 
roll back the breaking change and refactor the way `casefold` is processed. 
From my perspective this amended proposal offers an upside in language 
consistency without any downside.

--

___
Python tracker 

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



[issue35557] Allow lowercase hexadecimal characters in base64.b16decode()

2018-12-22 Thread Dylan Houlihan


Change by Dylan Houlihan :


--
type: performance -> behavior

___
Python tracker 

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



[issue35557] Allow lowercase hexadecimal characters in base64.b16decode()

2018-12-22 Thread Dylan Houlihan


Change by Dylan Houlihan :


--
versions:  -Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue35548] memoryview needlessly (?) requires represented object to be hashable

2018-12-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Mark, do you have thoughts on the subject?

> Perhaps another path is optionally allow hashing of memoryviews
>  (all current conditions - hashability of the original object)
>  via a parameter? Like unsafe_hash like in dataclass.

I suspect this would open a can worms and that we would regret it.

If a user intentionally creates an unsafe tool using dataclasses, they have to 
do so explicitly.  Built-in tools such as memoryview shouldn't cross that line 
(especially as a default behavior).  

Also, tools like memoryview() are implemented in C and generally have tighter 
requirements (thread-safety, protecting invariants, not segfaulting, etc) than 
pure python code that can't kill the interpreter or affect C extensions.


> I'll leave the issue up for a couple of days in case someone supports
> it, but I think this one of the rare cases where all core devs 
> would reject the feature unanimously.

I concur with Stefan.

> My particular use case involves a memory view of a readonly numpy's ndarray.

As Stefan mentioned, this could be "fixed" on the Numpy side if they thought it 
was a useful behavior (I suspect not).

--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue24390] Python 3.4.3 64 bits is not "high dpi aware"

2018-12-22 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

IDLE added a call to the Windows API in #33656.  Other than that, as Amaury 
stated, there isn't any UI in Python, so closing this as not a bug.

--
nosy: +cheryl.sabella
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



[issue35548] memoryview needlessly (?) requires represented object to be hashable

2018-12-22 Thread Ilya Kulakov


Ilya Kulakov  added the comment:

Perhaps another path is optionally allow hashing of memoryviews (all current 
conditions - hashability of the original object) via a parameter? Like 
unsafe_hash like in dataclass.

--
status: pending -> open

___
Python tracker 

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



[issue35559] Optimize base64.b16decode to use compiled regex

2018-12-22 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I don't think performance of base16 encoding is important enough to increase 
import times.  I would recommend rejection.

--

___
Python tracker 

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



[issue35564] [DOC] Sphinx 2.0 will require master_doc variable set in conf.py

2018-12-22 Thread jfbu


New submission from jfbu :

When building CPython doc with master branch of dev repo of Sphinx (future 
Sphinx 2.0) one gets this warning:

WARNING: Since v2.0, Sphinx uses "index" as master_doc by default. Please add 
"master_doc = 'contents'" to your conf.py.

Fix will be to do as Sphinx says :)

--
assignee: docs@python
components: Documentation
messages: 332371
nosy: docs@python, jfbu
priority: normal
severity: normal
status: open
title: [DOC] Sphinx 2.0 will require master_doc variable set in conf.py

___
Python tracker 

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



[issue23057] [Windows] asyncio: support signal handlers on Windows (feature request)

2018-12-22 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +10519

___
Python tracker 

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



[issue35514] Docs on reference count detail. enhancement.

2018-12-22 Thread Cheryl Sabella


Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue35559] Optimize base64.b16decode to use compiled regex

2018-12-22 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +10517

___
Python tracker 

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



[issue35559] Optimize base64.b16decode to use compiled regex

2018-12-22 Thread Cheryl Sabella


Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue35559] Optimize base64.b16decode to use compiled regex

2018-12-22 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests:  -10516

___
Python tracker 

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



[issue28791] update SQLite libraries for Windows and macOS installers

2018-12-22 Thread Zachary Ware


Change by Zachary Ware :


--
priority:  -> normal

___
Python tracker 

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



[issue28791] update SQLite libraries for Windows and macOS installers

2018-12-22 Thread Zachary Ware


Zachary Ware  added the comment:

Since we have a more recent "update SQLite" issue in bpo-35360, I'm going to go 
ahead and close this one.

--
assignee: benjamin.peterson -> 
resolution:  -> fixed
stage: patch review -> resolved
status: pending -> closed

___
Python tracker 

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



[issue2771] Test issue

2018-12-22 Thread Ezio Melotti


Ezio Melotti  added the comment:

test message via email

--

___
Python tracker 

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



[issue35563] Doc: warnings.rst - add links to references

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

You can bring this up at 
https://python.zulipchat.com/#narrow/stream/116501-workflow and someone might 
help.

--

___
Python tracker 

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



[issue35558] venv: running activate.bat gives ' parameter format not correct - 65001'

2018-12-22 Thread Nils Lindemann


Change by Nils Lindemann :


--
resolution:  -> duplicate
stage:  -> resolved
status:  -> closed

___
Python tracker 

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



[issue35555] IDLE: Gray out Code Context on non-editor windows

2018-12-22 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
keywords: +patch
pull_requests: +10515

___
Python tracker 

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



[issue35563] Doc: warnings.rst - add links to references

2018-12-22 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@xtreak, maybe it's related to the maintenance Ernest did yesterday on the 
bugs.python.org server?  Not sure the best way to ping him.

--

___
Python tracker 

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



[issue35563] Doc: warnings.rst - add links to references

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

@cheryl.sabella You're welcome. PR was not automatically added to couple of my 
issues too today though the PR description and issue number check was updated 
by bedevere-bot. I don't know if it's a random issue.

--
nosy: +xtreak

___
Python tracker 

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



[issue35563] Doc: warnings.rst - add links to references

2018-12-22 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

@xtreak, thanks for adding the PR link.  I was going to ask you how to do it, 
but I see it now.  Completely missed it before.

--

___
Python tracker 

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



[issue35563] Doc: warnings.rst - add links to references

2018-12-22 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue30698] asyncio sslproto do not shutdown ssl layer cleanly

2018-12-22 Thread Manjusaka


Manjusaka  added the comment:

Ping!

Agree with Wei-Cheng.

The leak still bothers me for times, and still bother for third-party like 
https://aiohttp.readthedocs.io/en/stable/client_reference.html#tcpconnector

Yury, I think it's worth working on it. Using uvloop should not be a good idea 
for some people.

--
nosy: +Manjusaka

___
Python tracker 

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



[issue35563] Doc: warnings.rst - add links to references

2018-12-22 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

I created a pull request for this, but it didn't attach it:
https://github.com/python/cpython/pull/11289

--

___
Python tracker 

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



[issue35563] Doc: warnings.rst - add links to references

2018-12-22 Thread Cheryl Sabella


New submission from Cheryl Sabella :

In the docs for the warnings module, there is some text referencing other areas 
of the documentation that would be more helpful as links.

--
assignee: docs@python
components: Documentation
messages: 332362
nosy: cheryl.sabella, docs@python
priority: normal
severity: normal
status: open
title: Doc: warnings.rst - add links to references
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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

> min_width сan be large negative number, and there are subtractions from it. 
> It may be safer to replace the assert with something like min_width = 
> Py_MAX(0, min_width). Or ensure that it is non-negative before calling 
> _PyUnicode_InsertThousandsGrouping()

Looking at the code the loop seems to operate on the assumption that min_width 
is >= 0 in the beginning with the assert statement until both remaining and 
min_width are negative to break out of the loop. Applying Py_MAX(0, min_width) 
causes no test failures but maybe I have missed adding a case where large 
negative min_width might have triggered other issue.

--

___
Python tracker 

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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue35562] Issue in sizeof() function

2018-12-22 Thread Ammar Askar


Ammar Askar  added the comment:

Iterating over _fields_ and adding up the sizeof() for each type could be one 
solution.

--

___
Python tracker 

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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

min_width сan be large negative number, and there are subtractions from it. It 
may be safer to replace the assert with something like min_width = Py_MAX(0, 
min_width). Or ensure that it is non-negative before calling 
_PyUnicode_InsertThousandsGrouping().

--

___
Python tracker 

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



[issue35562] Issue in sizeof() function

2018-12-22 Thread Amir Aslan Haghrah


Amir Aslan Haghrah  added the comment:

Thank you for your response.

I noticed this issue while working with 'mmap' and memory sharing.
As you said I check it in 'C++' and I got the same result for my struct as 
Python.
-
I used the 'sizeof' function to calculate my struct size to read it from mapped 
memory and I get wrong output in reading memory because of this aligning 
procedure.

Question: Structs map to memory unaligned but sizeof return the aligned size of 
struct.
How we can calculate the sizeof struct to use it in reading from memory?

--

___
Python tracker 

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



[issue35562] Issue in sizeof() function

2018-12-22 Thread Ammar Askar


Ammar Askar  added the comment:

This has to do with C struct packing and alignment. You are likely on a 64-bit 
computer and thus your structs are aligned to 8 byte (64 bit) boundaries.

https://docs.python.org/2/library/ctypes.html#structure-union-alignment-and-byte-order

Create an equivalent C program and you will notice the same behavior.

--
nosy: +ammar2
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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> This bug is not new, and this is the first report for it. It can be treated 
> as a security issue if an application allows user to specify format string. 
> But using a format string from untrusted source causes a security issue 
> itself, because this allows to spend memory and CPU time for creating an 
> arbitrary large string object. Also, unlikely debug builds be used in 
> production.

My initial thought was that since the assert failed it has exposed some bug or 
behavior change. Also I didn't know release builds remove assert statements. 
Since it's a case of debug build being a problem I agree with you that impact 
is low since it shouldn't be used in production.

> I would backport the solution of this issue to 3.6, but it is not bad if it 
> will be not backported. I think this is not a release blocker.

Thanks, I have created a PR with tests 
https://github.com/python/cpython/pull/11288 . For some reason it's not linked 
to the issue.

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

___
Python tracker 

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



[issue35562] Issue in sizeof() function

2018-12-22 Thread Amir Aslan Haghrah


New submission from Amir Aslan Haghrah :

If you define a structure which contains an 'c_int' and a 'c_double'  member. 
Then run the sizeof() function for it you get 16 as result as follows:

-
from ctypes import c_int
from ctypes import c_double
from ctypes import sizeof
from ctypes import Structure
from struct import Struct

class issueInSizeof(Structure):
_fields_ = [('KEY', c_int),
('VALUE',   c_double)]

print(sizeof(issueInSizeof))

-
output:
16
-

In continue if you add another 'c_int' to your structure and run sizeof() 
function as follows. It return 16 too.

-
from ctypes import c_int
from ctypes import c_double
from ctypes import sizeof
from ctypes import Structure
from struct import Struct

class issueInSizeof(Structure):
_fields_ = [('Index',   c_int),   
('KEY', c_int),  
('VALUE',   c_double)]

print(sizeof(issueInSizeof))

-
output:
16
-

If python assume the size of 'c_int' 4, then it should return 12 in the first 
run. Also if it assume the size of 'c_int' 8 then it should return 24 in the 
second run.

thanks in advance.

--
components: ctypes
messages: 332355
nosy: Amir Aslan Haghrah
priority: normal
severity: normal
status: open
title: Issue in sizeof() function
type: behavior
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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This bug is not new, and this is the first report for it. It can be treated as 
a security issue if an application allows user to specify format string. But 
using a format string from untrusted source causes a security issue itself, 
because this allows to spend memory and CPU time for creating an arbitrary 
large string object. Also, unlikely debug builds be used in production.

I would backport the solution of this issue to 3.6, but it is not bad if it 
will be not backported. I think this is not a release blocker.

--

___
Python tracker 

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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Sure, I will create one shortly. There were some other cases with different 
values of negative numbers that I will add since I couldn't see any tests 
failing on my debug builds. 

* Are there chances that bugs like these are present since I guess we use 
release builds in our CI? 
* Is this a release blocker for next RC since current set of 3.6.8 RC1 bugs 
fixes are complete I hope ?

--

___
Python tracker 

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



[issue35561] Valgrind reports Syscall param epoll_ctl(event) points to uninitialised byte(s)

2018-12-22 Thread Nikolaus Rath


Nikolaus Rath  added the comment:

$ ./configure CFLAGS="-O0 -g" --with-valgrind && make -j8

still gives

==13281== Memcheck, a memory error detector
==13281== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==13281== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==13281== Command: /home/nikratio/clones/cpython/python 
/home/nikratio/in-progress/pyfuse3/test/../examples/hello.py 
/tmp/pytest-of-nikratio/pytest-15/test_hello_hello_py_0
==13281== 
==13281== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==13281==at 0x584906A: epoll_ctl (syscall-template.S:84)
==13281==by 0xB5C07FA: pyepoll_internal_ctl (selectmodule.c:1392)
==13281==by 0xB5C08CB: select_epoll_register_impl (selectmodule.c:1438)
==13281==by 0xB5C112A: select_epoll_register (selectmodule.c.h:599)
==13281==by 0x173031: _PyMethodDef_RawFastCallKeywords (call.c:658)
==13281==by 0x2FEFCD: _PyMethodDescr_FastCallKeywords (descrobject.c:290)
==13281==by 0x21ED25: call_function (ceval.c:4611)
==13281==by 0x21AB4E: _PyEval_EvalFrameDefault (ceval.c:3183)
==13281==by 0x21007C: PyEval_EvalFrameEx (ceval.c:533)
==13281==by 0x17245F: function_code_fastcall (call.c:285)
==13281==by 0x1728B5: _PyFunction_FastCallKeywords (call.c:410)
==13281==by 0x21EDF4: call_function (ceval.c:4634)
==13281==  Address 0xffeff2d94 is on thread 1's stack
==13281==  in frame #1, created by pyepoll_internal_ctl (selectmodule.c:1379)

--

___
Python tracker 

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



[issue35561] Valgrind reports Syscall param epoll_ctl(event) points to uninitialised byte(s)

2018-12-22 Thread Stefan Krah


Stefan Krah  added the comment:

"--with-valgrind --with-pydebug" looks suspicious, it essentially
mixes two different memory checkers.

1) CFLAGS="-O0 -g" --without-pymalloc

2) CFLAGS="-O0 -g" --with-valgrind

should both work.


Can you try if this fixes the error?

--
nosy: +skrah

___
Python tracker 

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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Interpreter Core

___
Python tracker 

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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, seems the simplest way to fix this issue is to remove that assert. Do you 
mind to create a PR? Tests should be added to cover this case.

--

___
Python tracker 

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



[issue35561] Valgrind reports Syscall param epoll_ctl(event) points to uninitialised byte(s)

2018-12-22 Thread Nikolaus Rath


Nikolaus Rath  added the comment:

Same error with 3.7.1 and 3.6.7 (though line numbers differ slightly).

--

___
Python tracker 

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



[issue35561] Valgrind reports Syscall param epoll_ctl(event) points to uninitialised byte(s)

2018-12-22 Thread Nikolaus Rath


New submission from Nikolaus Rath :

With current git master, configured --with-valgrind --with-pydebug, I get:

==31074== Command: /home/nikratio/clones/cpython/python 
/home/nikratio/in-progress/pyfuse3/test/../examples/hello.py 
/tmp/pytest-of-nikratio/pytest-11/test_hello_hello_py_0
==31074== 
==31074== Syscall param epoll_ctl(event) points to uninitialised byte(s)
==31074==at 0x584906A: epoll_ctl (syscall-template.S:84)
==31074==by 0xBDAA493: pyepoll_internal_ctl (selectmodule.c:1392)
==31074==by 0xBDAA59F: select_epoll_register_impl (selectmodule.c:1438)
==31074==by 0xBDAA5F8: select_epoll_register (selectmodule.c.h:599)
==31074==by 0x174E15: _PyMethodDef_RawFastCallKeywords (call.c:658)
==31074==by 0x300BCA: _PyMethodDescr_FastCallKeywords (descrobject.c:290)
==31074==by 0x21FC05: call_function (ceval.c:4611)
==31074==by 0x22B5E7: _PyEval_EvalFrameDefault (ceval.c:3183)
==31074==by 0x2206FF: PyEval_EvalFrameEx (ceval.c:533)
==31074==by 0x173B61: function_code_fastcall (call.c:285)
==31074==by 0x174737: _PyFunction_FastCallKeywords (call.c:410)
==31074==by 0x21FDF4: call_function (ceval.c:4634)
==31074==  Address 0xffeffeb4c is on thread 1's stack
==31074==  in frame #1, created by pyepoll_internal_ctl (selectmodule.c:1379)

To reproduce:

$ python-dev -m pip install --user pyfuse3  # for dependencies
$ git clone https://github.com/libfuse/pyfuse3.git
$ valgrind --trace-children=yes "--trace-children-skip=*mount*" python-dev -m 
pytest test/


pyfuse3 provides a C extension module, but I believe the problem is in the 
interpreter core as the stacktrace does not include anything from the extension.

--
components: Interpreter Core
messages: 332348
nosy: nikratio
priority: normal
severity: normal
status: open
title: Valgrind reports Syscall param epoll_ctl(event) points to uninitialised 
byte(s)
type: compile error
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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Looking into the code min_width is returned as -2 and hence the assert fails. 
spec->n_min_width is passed as min_width to _PyUnicode_InsertThousandsGrouping 
that is used in the assert statement and I came across below comment that 
min_width can go negative and it's okay. So is the assert statement validating 
for it to be always greater than or equal to zero not needed?

https://github.com/python/cpython/blob/59423e3ddd736387cef8f7632c71954c1859bed0/Python/formatter_unicode.c#L529

/* min_width can go negative, that's okay. format->width == -1 means
   we don't care. */
if (format->fill_char == '0' && format->align == '=')
spec->n_min_width = format->width - n_non_digit_non_padding;
else
spec->n_min_width = 0;

--

___
Python tracker 

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



[issue32326] Update Build projects to version 10.0.16299.0 of the Windows 10 SDK.

2018-12-22 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

The PR was closed as not needed, so should this ticket also be closed?  Thanks!

--
nosy: +cheryl.sabella

__
Python tracker 

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



[issue35553] Test

2018-12-22 Thread Ernest W. Durbin III


Change by Ernest W. Durbin III :


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



[issue35548] memoryview needlessly (?) requires represented object to be hashable

2018-12-22 Thread Stefan Krah


Stefan Krah  added the comment:

The reason is that unfortunately readonly != immutable, as the
following example shows:

>>> import numpy as np
>>> x = np.array([1,2,3], dtype='B')
>>> y = x[:]
>>> y.flags['WRITEABLE'] = False
>>> m = memoryview(y)
>>> m.readonly
True
>>> m.tolist()
[1, 2, 3]
>>> x[0] = 100
>>> m.tolist()
[100, 2, 3]


An object like 'y' is allowed to re-export memory, using its own flags.

--

__
Python tracker 

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



[issue35548] memoryview needlessly (?) requires represented object to be hashable

2018-12-22 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue35533] argparse standard error usage for exit / error

2018-12-22 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +bethard
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



[issue35514] Docs on reference count detail. enhancement.

2018-12-22 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +serhiy.storchaka

__
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the feedback. I personally prefer 'expected' than 'expect' though it 
comes at the cost that this cannot be aligned with 'actual'. Other places use 
'expected' and it reads more natural in test case scenarios.

--

__
Python tracker 

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



[issue35553] Test

2018-12-22 Thread Ernest W. Durbin III


New submission from Ernest W. Durbin III :

Test

--
messages: 332304
nosy: EWDurbin
priority: normal
severity: normal
status: open
title: Test

__
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2018-12-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

We don't usually wrap error messages, but this is plausible.  With the addition 
to the first line, we don't need to repeat 'call'.  We can line things up 
without violating the PEP 8 recommendation against doing so with spaces.  Also, 
the convention is to not capitolize the phrase after ':'.

AssertionError: expected call not found.
Expect: mock(2, 3)
Actual: mock(1, 2)

--
nosy: +terry.reedy

__
Python tracker 

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



[issue11566] hypot define in pyconfig.h clashes with g++'s cmath

2018-12-22 Thread Kay Hayen


Change by Kay Hayen :


--
nosy:  -Kay.Hayen

__
Python tracker 

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



[issue35121] Cookie domain check returns incorrect results

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Looking further into this the domain validation makes it little more stricter 
and can have wider implications. For example requests library uses cookiejar to 
maintain cookies between sessions. One more case is that `domain` can be empty 
so only non-empty domains can be prefixed with dot.

A simple server that sets Cookie with value `A=LDJDSFLKSDJLDSF`

import SimpleHTTPServer
import logging

class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.cookieHeader = self.headers.get('Cookie')
SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)

def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)

def send_my_headers(self):
self.send_header('Set-Cookie', 'A=LDJDSFLKSDJLDSF')

if __name__ == '__main__':
SimpleHTTPServer.test(HandlerClass=MyHTTPRequestHandler)


Add below host entry to `/etc/hosts` 

127.0.0.1 test.com
127.0.0.1 1.test.com
127.0.0.1 footest.com


Sample script to demonstrate requests behavior change

import requests

with requests.Session() as s:
cookies = dict(cookies_are='working')
m = s.get("http://test.com:8000;, cookies=cookies)
print(m.request.headers)
m = s.get("http://1.test.com:8000;, cookies=cookies)
print(m.request.headers)
m = s.get("http://footest.com:8000;, cookies=cookies)
print(m.request.headers)


Before patch : 


{'User-Agent': 'python-requests/2.11.1', 'Accept-Encoding': 'gzip, deflate', 
'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'cookies_are=working'}
{'User-Agent': 'python-requests/2.11.1', 'Accept-Encoding': 'gzip, deflate', 
'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'A=LDJDSFLKSDJLDSF; 
cookies_are=working'}
{'User-Agent': 'python-requests/2.11.1', 'Accept-Encoding': 'gzip, deflate', 
'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'A=LDJDSFLKSDJLDSF; 
cookies_are=working'}

After patch :


{'User-Agent': 'python-requests/2.11.1', 'Accept-Encoding': 'gzip, deflate', 
'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'cookies_are=working'}
{'User-Agent': 'python-requests/2.11.1', 'Accept-Encoding': 'gzip, deflate', 
'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'A=LDJDSFLKSDJLDSF; 
cookies_are=working'}
{'User-Agent': 'python-requests/2.11.1', 'Accept-Encoding': 'gzip, deflate', 
'Accept': '*/*', 'Connection': 'keep-alive', 'Cookie': 'cookies_are=working'}


As with my patch since the cookie is set on `test.com` while making a request 
to `footest.com` the cookie is skipped as part of the patch since footest is 
not a subdomain of test.com but 1.test.com is a subdomain. This is a behavior 
change to be decided whether worth doing or to document this since in a client 
with session like requests module connecting to lot of hosts this can 
potentially pass cookies of test.com to footest.com. A discussion on requests 
repo on providing the option for user to set a stricter cookie policy : 
https://github.com/requests/requests/issues/2576

On testing with curl cookie-jar it seems that the cookies are passed even for 
the subdomain only when it's set and not as part of top level domain.

--

__
Python tracker 

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



[issue34823] libffi detection doesn’t work in my setup

2018-12-22 Thread Daniel Fetchinson


Daniel Fetchinson  added the comment:

I have the exact same issue, trying to compile 3.7.1 with a custom libffi 
location. Note that I must build libffi from source and can't install binaries 
provided by my distro, I believe this is the origin of the problem. Probably 
the python build system checks for libffi in some "standard" locations and it 
doesn't seem possible to use libffi from a custom location.

This is where libffi gets installed after passing --prefix=$HOME/opt to 
./configure:


$HOME/opt/lib64/libffi.so.6.0.4
$HOME/opt/lib64/libffi.a
$HOME/opt/lib64/libffi.la
$HOME/opt/lib64/libffi.so.6
$HOME/opt/lib64/libffi.so
$HOME/opt/lib/pkgconfig/libffi.pc
$HOME/opt/lib/libffi-3.2.1/include/ffi.h
$HOME/opt/lib/libffi-3.2.1/include/ffitarget.h
$HOME/opt/share/info/libffi.info

In any case, just to be sure, I've copied the header files to

$HOME/opt/include/ffi.h
$HOME/opt/include/ffitarget.h

And pkg-config works:

[fetch@fetch opt]$ pkg-config --libs libffi
-L/home/fetch/opt/lib/../lib64 -lffi

[fetch@fetch opt]$ pkg-config --cflags libffi
-I/home/fetch/opt/lib/libffi-3.2.1/include

These environment variables are also set:

LD_LIBRARY_PATH=/home/fetch/opt/lib:/home/fetch/opt/lib64

C_INCLUDE_PATH=/home/fetch/opt/include

And still _ctypes fails to build (but python itself (minus _ctypes) compiles 
successful and works perfectly well).

--
nosy: +fetchinson

__
Python tracker 

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



[issue11566] hypot define in pyconfig.h clashes with g++'s cmath

2018-12-22 Thread Matthew McCormick


Matthew McCormick  added the comment:

> What current 3.x versions have this issue?  This issue was opened against 2.7.

Yes, this is just for 2.7.

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



[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-22 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

__
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-12-22 Thread STINNER Victor


STINNER Victor  added the comment:

multiprocessing.Pool destructor now emits a ResourceWarning if it is still 
running: if .close() nor .terminate() have been called, see bpo- 35424.

It is a first alarm that the problematic example is wrong.

Should reconsider to fix this bug in the master branch? If yes, we should 
carefully document this backward incompatible change.

--

__
Python tracker 

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



[issue34823] libffi detection doesn’t work in my setup

2018-12-22 Thread Daniel Fetchinson


Daniel Fetchinson  added the comment:

It would be really great if this could be sorted out because at the moment this 
bug prevents me from using numpy/scipy with python 3.7.1 (they need _ctypes).

--

__
Python tracker 

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



[issue35547] email.parser / email.policy does not correctly handle multiple RFC2047 encoded-word tokens across RFC5322 folded headers

2018-12-22 Thread R. David Murray


R. David Murray  added the comment:

Here's a patch that makes the example work correctly.  This is not a fix, a 
real fix will be more complicated.  This just demonstrates the kind of thing 
that needs fixing and where.

The existing parser produces a sub-optimal parse tree as its result...the parse 
tree is hard to inspect and manipulate because there are so many special cases. 
 A good fix here would create some sort of function that could be passed an 
existing TokenList, the new token to add to that list, and the function would 
check all the special cases and do the EWWhiteSpaceTerminal substitution when 
and as appropriate.  This could then be used in the unstructured parser as well 
as Phrase...and some thought should be given to where else it might be needed.  
It has been long enough since I've held the RFCs in my head that I don't 
remember if there is anywhere else.

I haven't looked at the actual character string, so I don't know if we need to 
also be detecting and posting a defect about a split character or not, but we 
don't *have* to answer that question to fix this.

diff --git a/Lib/email/_header_value_parser.py 
b/Lib/email/_header_value_parser.py
index e805a75..d5d5986 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -199,6 +199,10 @@ class CFWSList(WhiteSpaceTokenList):
 
 class Atom(TokenList):
 
+@property
+def has_encoded_word(self):
+return any(t.token_type=='encoded-word' for t in self)
+
 token_type = 'atom'
 
 
@@ -1382,6 +1386,12 @@ def get_phrase(value):
 "comment found without atom"))
 else:
 raise
+if token.has_encoded_word:
+assert phrase[-1].token_type == 'atom', phrase[-1]
+assert phrase[-1][-1].token_type == 'cfws'
+assert phrase[-1][-1][-1].token_type == 'fws'
+if phrase[-1].has_encoded_word:
+phrase[-1][-1] = EWWhiteSpaceTerminal(phrase[-1][-1][-1], 
'fws')
 phrase.append(token)
 return phrase, value

--

__
Python tracker 

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



[issue11566] hypot define in pyconfig.h clashes with g++'s cmath

2018-12-22 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

What current 3.x versions have this issue?  This issue was opened against 2.7.  
This was changed to 3.3 in 2013 (3.3 should have just been added with 
control-click).  I reverted to 2.7 and tentatively added 3.8, but this needs to 
be checked.

The PR is against 2.7, though not so marked in the title.  (I will fix this.)  
Since the move to GitHub, we usually fix on master first and then backport.

Something is not right with the PR 880 linkage.  For me, anyway, Steve's 
reference is actually linked to 10880 (closed).

--
nosy: +terry.reedy
versions: +Python 2.7, Python 3.8 -Python 3.3

__
Python tracker 

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



[issue11566] hypot define in pyconfig.h clashes with g++'s cmath

2018-12-22 Thread Steve Dower


Steve Dower  added the comment:

The change in PR 880 looks fine to me. I dislike defining names without a Py 
prefix in public headers.

And PRs are not where we do general discussion or ping for attention. Make sure 
the nosy list includes the relevant experts (in this case probably me) and post 
on the issue. Posting on python-dev is also okay, though linking the bug is 
preferable to the PR.

--
nosy: +steve.dower

__
Python tracker 

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



[issue2771] Test issue

2018-12-22 Thread Ernest W. Durbin III


Ernest W. Durbin III  added the comment:

Testing after hosting migration completion

--

__
Python tracker 

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



[issue35548] memoryview needlessly (?) requires represented object to be hashable

2018-12-22 Thread Stefan Krah


Stefan Krah  added the comment:

I'll leave the issue up for a couple of days in case someone supports it, but I 
think this one of the rare cases where all core devs would reject the feature 
unanimously.

--
resolution:  -> not a bug
status: open -> pending
type:  -> enhancement

___
Python tracker 

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



[issue35548] memoryview needlessly (?) requires represented object to be hashable

2018-12-22 Thread Stefan Krah


Stefan Krah  added the comment:

Sorry I meant the above example to use a dict, which currently
does not work:

>>> d = {m: "1"}
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'numpy.ndarray'


Then the feature would allow to change the dict key.

--

___
Python tracker 

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



[issue35548] memoryview needlessly (?) requires represented object to be hashable

2018-12-22 Thread Stefan Krah


Stefan Krah  added the comment:

The feature would violate fundamental Python invariants. If you modify the 
example above:

>>> t = (m,)
>>> b"\001\002\003" in t
True
>>> x[0] = 100
>>> b"\001\002\003" in t
False


This is simply never supposed to happen in Python. If an immutable
object (Bytes) is regarded as being a member of a tuple, it should
stay in that tuple.


The issue has to be fixed on the NumPy side: They could implement
a scheme that allows hashing of a specific ndarray if a new flag
"IMMUTABLE" is set that locks the exporter and all exports.


I don't thing NumPy's current behavior can be regarded as a bug.
As I said, "readonly" never meant "immutable", it was always a
property of a single view.

--

___
Python tracker 

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



[issue35432] str.format and string.Formatter bug with French (and other) locale

2018-12-22 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vstinner

___
Python tracker 

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



[issue35560] format(float(123), "00") causes segfault in debug builds

2018-12-22 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

I was looking into format issues and came across msg99839 . The example causes 
segfault in master, 3.7 and 3.6 branches. This used to pass in 3.7 and 3.6. I 
searched for open issues and cannot come across an issue for this. I guess this 
is caused due to issue33954 which adds an assert as I can see from the 
segfault. Compiling in release mode works fine but debug build fails. Are 
asserts removed in release builds?

$ python3.7
Python 3.7.1rc2 (v3.7.1rc2:6c06ef7dc3, Oct 13 2018, 05:10:29)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> format(float(123), "00")
'123.0'

Master

master $ ./python.exe
Python 3.8.0a0 (heads/35559:c1b4b0f616, Dec 22 2018, 15:00:08)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> format(float(123), "00")
Assertion failed: (0 <= min_width), function 
_PyUnicode_InsertThousandsGrouping, file Objects/unicodeobject.c, line 9394.

Python 3.6

cpython git:(5241ecff16) ./python.exe
Python 3.6.8rc1+ (remotes/upstream/3.6:5241ecff16, Dec 22 2018, 15:05:57)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> format(float(123), "00")
Assertion failed: (0 <= min_width), function 
_PyUnicode_InsertThousandsGrouping, file Objects/unicodeobject.c, line 9486.
[1]33859 abort  ./python.exe

Python 3.7

cpython git:(c046d6b618) ./python.exe
Python 3.7.2rc1+ (remotes/upstream/3.7:c046d6b618, Dec 22 2018, 15:07:24)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> format(float(123), "00")
Assertion failed: (0 <= min_width), function 
_PyUnicode_InsertThousandsGrouping, file Objects/unicodeobject.c, line 9369.
[1]42710 abort  ./python.exe


Latest master, 3.6 and 3.7 branch has this bug in debug mode with this being 
last Python 3.6 bug fix release. Commenting out the assert line gives me the 
correct result but I have limited knowledge of the C code and I guess release 
builds remove asserts where it cannot be reproduced? I am tagging issue33954 
devs who might have a better understanding of this and there might be limited 
bandwidth for someone to look into this along with other cases since it's 
holiday season.

# Release mode works fine

./python.exe -c 'print(format(float(123), "00"))'
123.0

--
messages: 332342
nosy: eric.smith, serhiy.storchaka, vstinner, xtreak
priority: normal
severity: normal
status: open
title: format(float(123), "00") causes segfault in debug builds
type: crash
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



[issue24307] [Python 2] pip error on windows whose current user name contains non-ascii characters

2018-12-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> third party
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



[issue30455] Generate all tokens related code and docs from Grammar/Tokens

2018-12-22 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue35559] Optimize base64.b16decode to use compiled regex

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Serhiy, the other issue noted about performance improvement removing 
casefold and I thought re.search per call to be inefficient. My bad that I 
didn't consider the cost of moving the compilation to module level that affects 
import time and about using -X importtime. I agree that the cost is not worthy 
given that regex is used only inside b16decode. I will keep these factors in 
mind when I am doing similar sort of work and try to do a better analysis.

--

___
Python tracker 

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



[issue35009] argparse throws UnicodeEncodeError for printing help with unicode choices

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Serhiy, I have limited knowledge of unicode and hence I thought this to 
be a fix. I am closing this as per msg332337 and the PR I opened for issue24307 
(Feel free to close issue24307 as per Victor's resolution if needed)

--
resolution:  -> wont fix
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



[issue35559] Optimize base64.b16decode to use compiled regex

2018-12-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

According to your results, you will save 0.94 us per call of b16decode, but 
loss 126 us at import time. You will get a benefit if b16decode is used more 
than 130 time.

Currently, if the performance is critical, the user can use 
binascii.unhexlify() directly or use bytes.fromhex(). base64.b16decode() is 
only needed if you need to ensure that the input strictly conforms to RFC 3548.

Other options, which will maximize the performance while keeping the validation 
is to add an option to binascii.unhexlify() for making it more strict. At the 
time of writing the base64 module its performance was not considered critical, 
and additional checks and preprocessing was implemented in Python.

--
nosy: +barry, pitrou

___
Python tracker 

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



[issue35009] argparse throws UnicodeEncodeError for printing help with unicode choices

2018-12-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Even if you encode default values for output, you can not pass unicode values 
from command line. You can pass a 8-bit string 
'\xe6\x97\xa9\xe4\xb8\x8a\xe5\xa5\xbd' which differs from a Unicode string 
u"早上好". Even after resolving the output issue, unicode choices will never work.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue24307] [Python 2] pip error on windows whose current user name contains non-ascii characters

2018-12-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Even if you encode the Unicode default for output, the user can not specify the 
same value, unless you use custom converter. For example, if you encode u"早上好" 
as string "\xe6\x97\xa9\xe4\xb8\x8a\xe5\xa5\xbd" (in UTF-8), the user can only 
specify the argument as a 8-bit string "\xe6\x97\xa9\xe4\xb8\x8a\xe5\xa5\xbd" 
which differs from a Unicode string u"早上好".

Even if you use a custom converter which decodes 8-bit strings to Unicode, it 
makes sense to specify the default value as encoded string, because it will be 
pass to the converter.

Non-ascii unicode values never supported as default values. This issue is 
rather a feature request than a bug report. It is too late to add new features 
in 2.7. The right solution is to upgrade to Python 3. Eventually, solving 
similar issues was one of purposes of creating Python 3.

--

___
Python tracker 

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



[issue13927] Extra spaces in the output of time.ctime

2018-12-22 Thread Antti Haapala


Antti Haapala  added the comment:

This should be added to `asctime` too.

The space-padded behaviour complies with the C standard which was the intent - 
after all, before it was using C `asctime` directly, and says that unlike C 
asctime, it doesn't have the newline character, meaning that as a rule, it 
should then behave similar to it, and only exception is marked.

Unfortunately MSVC asctime has been incorrectly using leading zeros 
(https://stackoverflow.com/q/53894148/918959).

--
nosy: +ztane

___
Python tracker 

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



[issue35559] Optimize base64.b16decode to use compiled regex

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> How this affects the import time (use -X importtime)?

Is there reliable way to benchmark this?

On multiple runs with regex for python3 -X importtime -c 'import base64'

import time:   677 |  11151 | base64

On multiple runs without regex for python3 -X importtime -c 'import base64'

import time:   551 |   5726 | base64

--

___
Python tracker 

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



[issue35559] Optimize base64.b16decode to use compiled regex

2018-12-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks @scoder . I took the convention since most of the places I have seen 
capitalized variable ending with PAT but this looks more readable to me. I have 
made the changes in my PR.

--

___
Python tracker 

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