[issue33084] Computing median, median_high an median_low in statistics library

2018-03-15 Thread Luc

New submission from Luc :

When a list or dataframe serie contains NaN(s), the median, median_low and 
median_high are computed in Python 3.6.4 statistics library, however, the 
results are wrong.
Either, it should return a NaN just like when we try to compute a mean or point 
the user to drop the NaNs before computing those statistics.
Example:
import numpy as np
import statistics as stats

data = [75, 90,85, 92, 95, 80, np.nan]
Median  = stats.median(data)
Median_low = stats.median_low(data)
Median_high = stats.median_high(data)
The results from above return ALL 90 which are incorrect.

Correct answers should be:
Median = 87.5
Median_low  = 85
Median_high = 92
Thanks,
Luc

--
components: Library (Lib)
messages: 313933
nosy: dcasmr
priority: normal
severity: normal
status: open
title: Computing median, median_high an median_low in statistics library
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-03-15 Thread Elias Zamaria

Elias Zamaria  added the comment:

Mark, I tried `Fraction(10**23) // 1e22`, and I got 10.

Your `10**23 // 1e22` example was strange, but then `int(1e23)` and got 
1611392. That is kind of unexpected but I think it is rare for 
anyone to do something like that with numbers that big.

I think the fact that floating-point rounding error sometimes causes strange 
results is not a reason to do really unexpected things like making 1.0 // 1/10 
equal 9.0, if that can be reasonably avoided.

I updated my pull request with my change, which you suggested, to make 
__rfloordiv__ and __rmod__ return a float, but with a small change to 
_operator_fallbacks to avoid the rounding error, so 1.0 // 1/10 is 10.0. You 
can see it at 
https://github.com/python/cpython/pull/5956/commits/1020bb219c1a4fad575ee2309c930ce82a4777fb#diff-14d03bfb59581367725b00781e6f802fL391.
 What do you think?

--

___
Python tracker 

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



[issue33042] New 3.7 startup sequence crashes PyInstaller

2018-03-15 Thread pmpp

Change by pmpp :


--
nosy: +pmpp

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-15 Thread Eric V. Smith

Eric V. Smith  added the comment:

Yes, you're right, it can't be changed. And .port is documented as raising 
ValueError, so it's all working correctly. I think improving the ValueError 
message, as the PR does, is as good as we can do.

--

___
Python tracker 

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



[issue32799] returned a result with an error set

2018-03-15 Thread Ned Deily

Change by Ned Deily :


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



[issue33080] regen-importlib is causing build races against other regen-all targets in Makefile.pre.in

2018-03-15 Thread Ned Deily

Change by Ned Deily :


--
nosy: +vstinner

___
Python tracker 

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



[issue33079] subprocess: document the interaction between subprocess.Popen and os.set_inheritable

2018-03-15 Thread Ned Deily

Change by Ned Deily :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue33036] test_selectors.PollSelectorTestCase failing on macOS 10.13.3

2018-03-15 Thread Ned Deily

Change by Ned Deily :


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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2018-03-15 Thread Ned Deily

Change by Ned Deily :


--
nosy: +davin, pitrou

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-15 Thread Matt Eaton

Matt Eaton  added the comment:

"Wouldn't we be better off to catch this error at parse time, instead of just 
improve the error message when .port is called?"

I think there could be a case to be made about catching and dealing with this 
error in urlparse() / urlsplit() instead of displaying an error when port 
property is used.  I think that approaching it this way would cut right to the 
problem and alleviate carrying around a potentially bad port value.  However, 
if the port error was caught during parsing but the url, scheme, etc.. values 
were still valid, are we taking away something from the user by raising the 
error too soon?  Just a thought.

--

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-15 Thread Eric V. Smith

Eric V. Smith  added the comment:

Wouldn't we be better off to catch this error at parse time, instead of just 
improve the error message when .port is called?

I'm not sure why port is a property and not just computed. Maybe the least 
intrusive way of doing this would be to just evaluate self.port after the 
parsing is completed?

--
nosy: +berker.peksag, eric.smith

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-15 Thread Eric V. Smith

Eric V. Smith  added the comment:

Although having said that, we probably can't make that change for 2.7. And 
maybe it's even too big a change for 3.8.

--

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2018-03-15 Thread Henrique Andrade

Henrique Andrade  added the comment:

Unfortunately this is not the case.

I will shrink my repro down to a more manageable size and post it here.

--

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2018-03-15 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Notice that the writer gets closed when it receives a sentinel value (which how 
the queue knows when to close as part of the design):

>>> x.put(multiprocessing.queues._sentinel)

If you call close after this line there will not be any fd associated with the 
queue open.

--

___
Python tracker 

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-15 Thread Guido van Rossum

Guido van Rossum  added the comment:

Apart from the fact that it's too late, if you had to do it over again,
could it be done as a class decorator?

Anyway, let's keep this issue open but reclassify it as a docs issue.

--

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2018-03-15 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

The way is to delete the object. IMHO I would not say is "leaked" as the object 
is still alive and holds resources and these resources are properly handled on 
destruction.

I cannot think of an immediate use case of closing both file descriptors but 
not deleting the object.

--

___
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-15 Thread Brett Cannon

Brett Cannon  added the comment:

Please open a separate issue for the test_poplib issue.

--

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2018-03-15 Thread Henrique Andrade

Henrique Andrade  added the comment:

Pablo, but there is no way to close the other side.

Indeed, if you look in the implementation, you will see that the writer file 
descriptor can't be closed.

--

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2018-03-15 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Is not leaked as the object is still alive. Only one side is closed when you 
call "closed". If you destroy the object:

>>> del x

You will see that there are no more file descriptors in /proc/PID/fd associated 
with that queue.

Also, notice that closed() is called when the queue is destroyed.

--
nosy: +pablogsal

___
Python tracker 

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



[issue33083] math.factorial accepts non-integral Decimal instances

2018-03-15 Thread Stefan Krah

Change by Stefan Krah :


--
nosy:  -skrah

___
Python tracker 

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-15 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

I would say it is too late. `typing.NamedTuple` is out there for more than a 
year and is quite actively used. A search on GitHub shows thousands of files 
that import `typing.NamedTuple` and a macroscopic fraction of those use it with 
the class syntax. I think the damage from breaking working code outweighs the 
potential bugs here. A clear example in the docs that explains how it works 
would be sufficient I think.

(Also a camel case decorator would look weird.)

--

___
Python tracker 

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-15 Thread Eric V. Smith

Eric V. Smith  added the comment:

I once thought of building NamedTuple functionality into dataclasses, either as 
a parameter to @dataclass or as a new decorator. But it didn't get very far.

It would have to return a different class, like NamedTuple does, and this 
didn't fit in well with the original "keep @dataclass simple" mantra.

It would also be especially confusing with frozen already existing.

--

___
Python tracker 

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-15 Thread Guido van Rossum

Guido van Rossum  added the comment:

I wonder if it's too late to conclude that NamedTuple in this context
should have been a class decorator rather than a base class. With a class
decorator it's more understandable that the effect doesn't automatically
apply to subclasses.

--

___
Python tracker 

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



[issue33083] math.factorial accepts non-integral Decimal instances

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Many functions implemented in C accept Decimal instances.

>>> chr(decimal.Decimal(65.2))
'A'

This is because PyLong_AsLong() and similar functions call __int__().

Floats are specially prohibited when convert arguments with PyArg_Parse() with 
the "i" format unit.

>>> chr(65.2)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: integer argument expected, got float

The specific of factorial() is that it accepts integral floats and raises 
ValueError instead of TypeError for non-integral floats. Maybe it was planned 
to extend factorial() to non-integral floats by using a gamma function. All 
other functions in the math module worked with floats at the time of adding 
factorial() in issue2138. math.gamma() was added 1.5 years later in issue3366.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

2018-03-15 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Yes, this is because subclassing `typing.NamedTuple` is not an actual 
subclassing, but is just a syntactic sugar for calling 
`collections.namedtuple`. A discussion about allowing subclassing/extending 
named tuples previously appeared in https://github.com/python/typing/issues/427 
but was subsequently closed as wontfix. In short, the argument was that we 
should keep feature set and implementation of named tuples simple/minimalistic, 
and instead recommend dataclasses for all more complex use cases. Note however, 
that this decision was never added to the `typing.NamedTuple` documentation. I 
think it totally makes sense to clarify this in the docs.

--

___
Python tracker 

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



[issue33083] math.factorial accepts non-integral Decimal instances

2018-03-15 Thread John Yeung

Change by John Yeung :


--
nosy: +John.Yeung

___
Python tracker 

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



[issue33082] multiprocessing docs bury very important 'callback=' args

2018-03-15 Thread Chad

Change by Chad :


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

___
Python tracker 

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



[issue33082] multiprocessing docs bury very important 'callback=' args

2018-03-15 Thread Mariatta Wijaya

Change by Mariatta Wijaya :


--
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue33082] multiprocessing docs bury very important 'callback=' args

2018-03-15 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

Can you make your PR in python/cpython GitHub repo, instead of your own fork?

--
nosy: +Mariatta

___
Python tracker 

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



[issue32799] returned a result with an error set

2018-03-15 Thread Eli Ribble

Eli Ribble  added the comment:

You can feel free to close the bug - I no longer work for the company that had 
this problem and I was only reporting the bug because the documentation 
specifically requested I do so. I don't have the ability now to try upgrading 
the version of Python to see if it resolves the problem. I also no longer have 
access to the stack traces.

The code in question did not use threading, forking or signal handlers and I no 
longer have the rights to provide the wrapped code.

--

___
Python tracker 

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



[issue25735] math.factorial doc should mention integer return type

2018-03-15 Thread Mark Dickinson

Mark Dickinson  added the comment:

I opened #33083, and copied the nosy list from this issue across.

--

___
Python tracker 

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



[issue33083] math.factorial accepts non-integral Decimal instances

2018-03-15 Thread Mark Dickinson

New submission from Mark Dickinson :

Observed by Terry Reedy in the issue #25735 discussion (msg255479):

>>> factorial(decimal.Decimal(5.2))
120

This should be either raising an exception (either ValueError or TypeError, 
depending on whether we want to accept only integral Decimal values, or 
prohibit Decimal values altogether), or possibly returning an approximation to 
Gamma(6.2) (=169.406099461722999629...)

I'd prefer that we prohibit a Decimal input altogether, but accepting integral 
Decimal instances would parallel the current behaviour with floats:

>>> factorial(5.2)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: factorial() only accepts integral values
>>> factorial(5.0)
120


Terry also observed:

>>> factorial(Fraction(5))
Traceback (most recent call last):
  File "", line 1, in 
TypeError: an integer is required (got type Fraction)

--
messages: 313912
nosy: facundobatista, mark.dickinson, rhettinger, skrah, terry.reedy
priority: normal
severity: normal
status: open
title: math.factorial accepts non-integral Decimal instances
type: behavior
versions: Python 2.7, 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



[issue25735] math.factorial doc should mention integer return type

2018-03-15 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Sounds good.  Thanks, Mark.

@mine0901, would you like to open a Github pull request for your patch?  Thanks!

--

___
Python tracker 

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




[issue25735] math.factorial doc should mention integer return type

2018-03-15 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Should the documentation patch for this be converted to a PR

I think so, yes. How about we open a new issue for the factorial(Decimal(...)) 
behaviour, and keep this one focused on the original reported issue?

--

___
Python tracker 

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



[issue25735] math.factorial doc should mention integer return type

2018-03-15 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Should the documentation patch for this be converted to a PR or does this need 
to change to a bug issue to address Mark's concerns?

Thanks!

--
nosy: +csabella
stage:  -> needs patch
versions: +Python 3.7, Python 3.8 -Python 3.5

___
Python tracker 

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



[issue21611] int() docstring - unclear what number is

2018-03-15 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Is this superseded by issue 26701?

--
nosy: +csabella

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Christian Heimes

Christian Heimes  added the comment:

/me bets his money on Stefan and Tim

--

___
Python tracker 

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



[issue27657] urlparse fails if the path is numeric

2018-03-15 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
stage:  -> patch review
versions: +Python 3.7, Python 3.8 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue33082] multiprocessing docs bury very important 'callback=' args

2018-03-15 Thread Chad

Chad  added the comment:

https://github.com/chadmiller-amzn/cpython/pull/1

(Putting that in "GitHub PR" field says "Edit Error: Unknown PR format, 
acceptable formats are: full github URL, #pr_number, pr_number")

--
versions: +Python 3.4, Python 3.5

___
Python tracker 

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



[issue33082] multiprocessing docs bury very important 'callback=' args

2018-03-15 Thread Ned Deily

Change by Ned Deily :


--
nosy: +davin, pitrou
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue33082] multiprocessing docs bury very important 'callback=' args

2018-03-15 Thread Chad

New submission from Chad :

Callbacks are really important in multiprocessing. Doc writer almost ignores 
them.

--
assignee: docs@python
components: Documentation
messages: 313905
nosy: chadmiller-amzn, docs@python
priority: normal
severity: normal
status: open
title: multiprocessing docs bury very important 'callback=' args
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, 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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Tim Peters

Tim Peters  added the comment:

If you want to deprecate the method, bring that up on python-dev or 
python-ideas.  It's inappropriate on the issue tracker (unless, e.g., you open 
a new issue with a patch to rip it out of the language).  It's also 
inappropriate to keep on demanding in _this_ issue that people justify a method 
that already exists.  For that reason, I'm not responding again to more 
repetitions of that here.

--

___
Python tracker 

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



[issue33042] New 3.7 startup sequence crashes PyInstaller

2018-03-15 Thread Ned Deily

Ned Deily  added the comment:

Nick, what's your assessment of this issue's priority?  Is it a release blocker 
for 3.7.0b3 (proposed ABI freeze)?  For 3.7.0rc1 (code freeze)?  None of the 
above?

--
nosy: +ned.deily

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I am proposing to deprecate float.is_integer() and remove it in 3.10. After 
deprecating float.as_integer() we shouldn't bother about adding 
int.is_integer().

If this method is necessary in implementing various math libraries please show 
me the code of these libraries that call float.is_integer() or which will get a 
benefit from adding is_integer() in int and Decimal.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Tim Peters

Tim Peters  added the comment:

Serhiy, nobody is proposing to add float.as_integer().  It already exists:

>>> (3.1).is_integer()
False

I already allowed I don't have a feel for how _generally_ useful it is, but you 
have at least my and Stefan's word for that the functionality (however spelled) 
_is_ necessary in implementing various math libraries.

If we outlawed float functions that the numerically naive may misuse, we'd have 
to remove floats entirely.

Given that it's _already in the language_, the only question here is whether to 
make it play nice with types beyond just `float`.  I expect you'd have a hard 
time constructing an example where int.is_integer() returned a misleading 
result ;-)

--

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2018-03-15 Thread Henrique Andrade

Henrique Andrade  added the comment:

Correcting my original - after close():

> ll /proc/8096/fd
total 0
dr-x-- 2 hcma hcma  0 2018-03-15 14:03:23.210089578 -0400 .
dr-xr-xr-x 9 hcma hcma  0 2018-03-15 14:03:23.190089760 -0400 ..
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 0 -> /dev/pts/25
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 1 -> /dev/pts/25
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:23.210089578 -0400 2 -> /dev/pts/25
l-wx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 4 -> 
pipe:[44076946]
lr-x-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 5 -> /dev/urandom

--

___
Python tracker 

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



[issue33081] multiprocessing Queue leaks a file descriptor associated with the pipe writer

2018-03-15 Thread Henrique Andrade

New submission from Henrique Andrade :

A simple example like such demonstrates that one of the file descriptors 
associated with the underlying pipe will be leaked:

>>> from multiprocessing.queues import Queue
>>> x = Queue()
>>> x.close()

Right after the queue is created we get (assuming the Python interpreter is 
associated with pid 8096 below):

> ll /proc/8096/fd
total 0
dr-x-- 2 hcma hcma  0 2018-03-15 14:03:23.210089578 -0400 .
dr-xr-xr-x 9 hcma hcma  0 2018-03-15 14:03:23.190089760 -0400 ..
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 0 -> /dev/pts/25
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 1 -> /dev/pts/25
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:23.210089578 -0400 2 -> /dev/pts/25
lr-x-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 3 -> 
pipe:[44076946]
l-wx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 4 -> 
pipe:[44076946]
lr-x-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 5 -> /dev/urandom

After close():

> ll /proc/8096/fd
total 0
dr-x-- 2 hcma hcma  0 2018-03-15 14:03:23.210089578 -0400 .
dr-xr-xr-x 9 hcma hcma  0 2018-03-15 14:03:23.190089760 -0400 ..
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 0 -> /dev/pts/25
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 1 -> /dev/pts/25
lrwx-- 1 hcma hcma 64 2018-03-15 14:03:23.210089578 -0400 2 -> /dev/pts/25
lr-x-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 3 -> 
pipe:[44076946]
l-wx-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 4 -> 
pipe:[44076946]
lr-x-- 1 hcma hcma 64 2018-03-15 14:03:33.145998954 -0400 5 -> /dev/urandom

--
components: Library (Lib)
messages: 313899
nosy: Henrique Andrade
priority: normal
severity: normal
status: open
title: multiprocessing Queue leaks a file descriptor associated with the pipe 
writer
versions: Python 2.7

___
Python tracker 

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



[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Mark Dickinson

Mark Dickinson  added the comment:

[Tim]

> [...] what would _you_ like to see done here?

Given that float.as_integer_ratio and Decimal.as_integer_ratio already exist, 
and that I don't have a working time machine right now, I'm in favour of adding 
int.as_integer_ratio purely for duck-typing reasons: I want to be able to use 
an int where a float is expected, and I _have_ encountered code in the past 
where I have to think too hard about what precise types are being used, and 
where that thinking seems as though it shouldn't be necessary. For the same 
reason, I'd support as_integer_ratio on the Fraction type. I don't really care 
whether it gets there via the Rational ABC or not. Adding as_integer_ratio to 
Rational as an @abstractmethod _does_ seem a step too far (because now anyone 
who registers a type with numbers.Integral or numbers.Rational has to implement 
as_integer_ratio), but my understanding is that that's not what's being 
proposed.

It doesn't bother me that the NumPy integer types won't support 
as_integer_ratio immediately (or possibly ever). The floating-point types don't 
either (except np.float64, which only has it because it inherits directly from 
Python's float), and it's hard to see how as_integer_ratio could be useful for 
a NumPy float32 array (for example), given that the returned numerator and 
denominator could exceed the bounds of any of the fixed-width NumPy integer 
types. I write a lot of NumPy-using code, but the world in which I do so rarely 
meets the world where I care about correct rounding, fractions, counting ulps 
error, etc. I haven't missed float32.as_integer_ratio or 
float16.as_integer_ratio yet.

If we're worried about NumPy compatibility, it might be interesting to get 
Nathaniel Smith's opinion.

--
nosy: +njs

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I do not see a point in adding a function that will never be used correctly.

--

___
Python tracker 

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



[issue28677] difficult to parse sentence structure in "When an instance attribute is referenced that isn't a data attribute"

2018-03-15 Thread Cheryl Sabella

Change by Cheryl Sabella :


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



[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Tim Peters

Tim Peters  added the comment:

Thanks, Mark!  So if int.as_integer_ratio is added to the core, numpy.int64 
won't magically have it too, regardless of whether we do or don't add an 
implementation to numbers.Rational.

As an end user, I'd be surprised if numpy.int64 didn't support the same stuff 
as core ints.  I doubt I'd care at all what numbers.Rational said in cases 
where it didn't.

But rather than argue about that, what would _you_ like to see done here?

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Tim Peters

Tim Peters  added the comment:

[Raymond]
> The OPs notion of "absurd" behavior implies a rule that
> all float methods should be available for ints.  That
> would suggest the is_integer, hex, fromhex, and
> as_integer_ratio would all need to propagate to the
> other types as well.  I don't think we should start
> sliding down that slope.

Given that Guido recently said it was absurd that int.hex() doesn't exist, and 
that another PR to add int.as_integer_ratio() is in progress, we'll soon be 
halfway down that slope looking up ;-)

The OP is right that in a world where you _can't tell_ from staring at the code 
whether you'll get back an int or a float, sometimes not even when you know the 
input types (like `int**int`), it can be jarring when degenerate cases (like 
int.is_integer()) refuse to do the obvious thing.

So I'm in favor given that float.is_integer() already exists.

While I have no feel for how generally useful is_integer() may be, there are 
many use cases when _implementing_ math functions.  For example,

>>> (-1.0) ** 3.1
(-0.9510565162951536-0.30901699437494706j)
>>> (-1.0) ** 3.0
-1.0

Here not only the value, but the _type_ of the result depends on whether the 
power is an exact integer.  The only way to know the latter is to spell 
is_integer() in _some_ way.  Given that x is a finite double, `x == int(x)` may 
be used in Python, or `x == floor(x)` in C or even `fmod(fabs(x), 1.0) == 0.0`.

As Mark pointed out, those kinds of ways can be woefully inefficient for 
Decimals, so adding is_integer() to Decimal too supplies a uniform way for 
users to spell the functionality that types can implement in a way best for 
them.

--

___
Python tracker 

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



[issue33080] regen-importlib is causing build races against other regen-all targets in Makefile.pre.in

2018-03-15 Thread Alexander Kanavin

New submission from Alexander Kanavin :

You can see here:

https://github.com/python/cpython/blob/master/Makefile.pre.in#L708

that regen-importlib is building a binary from .o files which are built from .c 
and .h files, which are, at the same time, regenerated by other regen- targets.

This does cause build errors in heavily parallelized builds, we've been seeing 
it regularly in Yocto Project lately:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=12596

I tried to see if I can easily correct target dependencies in the makefile, but 
couldn't figure it out. So, a workaround, for us, would be to issue 'make 
regen-importlib' ahead of other things:

make regen-importlib
make regen-all

--
components: Build
messages: 313894
nosy: Alexander Kanavin
priority: normal
severity: normal
status: open
title: regen-importlib is causing build races against other regen-all targets 
in Makefile.pre.in
versions: Python 3.5, 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



[issue32328] ttk.Treeview: _tkinter.TclError: list element in quotes followed by "; " instead of space

2018-03-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Our ttk doc, https://docs.python.org/3/library/tkinter.ttk.html#item-options, 
here copies the tk doc: "The list of values associated with the item."  It 
should say 'tuple or list', but that is a generic (and separate) issue of our 
ttk doc not translating '(tcl) list' to '(python) sequence' or '(python) tuple 
or list'.

The NMT doc, 
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/ttk-Treeview.html, is 
unnecessarily vague ('data items') about what needs to be passed for values.  
It correctly notes that a single string is accepted for tags, but I don't know 
that this is guaranteed.

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



[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Mark Dickinson

Mark Dickinson  added the comment:

It's a "virtual" subclass. The numpy.integer parent class is registered here:

https://github.com/numpy/numpy/blob/10ccfe747a68d974ff16a5c0765054b816d5486f/numpy/core/numerictypes.py#L944

--

___
Python tracker 

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



[issue33042] New 3.7 startup sequence crashes PyInstaller

2018-03-15 Thread Jonathan Springer

Change by Jonathan Springer :


--
nosy: +springermac

___
Python tracker 

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



[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Tim Peters

Tim Peters  added the comment:

Serhiy, I don't understand.  If `numbers.Rational` is in fact a superclass of 
`numpy.int64`, then the latter will inherit an implementation added to the 
former.  The idea here isn't to add an abstract method to the Rational 
interface, but a concrete default implementation:

class Rational(Real):
...
def as_integer_ratio(self):
return (self.numerator, self.denominator)

Or, as for Python ints, is Rational a "make believe" (virtual) superclass of 
numpy.int64?

--

___
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-15 Thread Siddhesh Poyarekar

Siddhesh Poyarekar  added the comment:

I forgot to clarify that the function cast warning allows for variable argument 
casts as a wildcard, which is my basis for the PyObject *(*)(PyObject *, 
PyObject *, ...) fix proposal.

--

___
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-15 Thread Siddhesh Poyarekar

Siddhesh Poyarekar  added the comment:

> The warning in GCC shouldn't probably have been enabled at all in `-Wall 
> -Wextra` because the cast is explicit. However, it is somewhat true.

The explicit cast is precisely what enables the more nuanced function cast 
warning where it checks the function for type compatibility.  That is, it will 
check the types of the return and arguments and then warn in case of mismatch.

> However, the correct way to fix would be to have the METH_NOARGS case cast 
> the function to the right prototype. There exists lots of existing code that 
> *is* going to break too. 

AFAICT, there is no right prototype for the METH_NOARGS function; there used to 
be a PyCFunctionWithNoArguments but that seems to have fallen out of favour 
some time back.  The prototype that seems to be commonly in use (and in clinic 
as well, which is what I based my patches on) is the PyCFunction, which seems 
like a safe way to do things.

> Perhaps PyCFunction should declare no prototype, i.e. empty parentheses, for 
> backwards compatibility:
> 
> typedef PyObject *(*PyCFunction)();
> 
> and deprecate it; start using a new typedef for it - and then add proper 
> casts in every place that call a function.

I have a patch in the works that makes it PyObject *(*)(PyObject *, PyObject *, 
...)

which allows for two compulsory arguments (fits in with most cases, provided 
the METH_NOARGS patch is accepted) and then the rest depending on the type of 
the cast function.  The rest of the PyMethodDef functions are much simpler 
fixes this way.  It also seems like a more intuitive description of the 
callbacks.

Then there are getter and setter and other function pointers that need similar 
fixes to METH_NOARGS.

--

___
Python tracker 

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



[issue32421] Keeping an exception in cache can segfault the interpreter

2018-03-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I repeated Julian's test with installed 3.7.0b2 on Windows 10 and there is no 
crash when running either from a command line or from an IDLE editor.  So 
either the issue has been fixed since 3.6.2, or it is specific to some 
undisclosed system or class of systems, or the specific claim in the title is a 
misinterpretation of behavior.  In any case, there is currently no possibility 
of action on our part.

Yonatan, if you have the promised minimal reproducible test case, for current 
python, please post it, with version and OS.  If not, we should close this 
('not a bug' fits best) until there is one.

--
stage:  -> test needed

___
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-15 Thread Jay Yin

Jay Yin  added the comment:

it seems to me like the issue in my tests is that some SSL thing is failing?, 
anyone have any experience with this?

--

___
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-15 Thread Antti Haapala

Antti Haapala  added the comment:

Yea, I looked into `ceval.c` and the function is *called incorrectly*, so there 
is undefined behaviour there - it has been wrong all along, in 3.5 all the way 
down to 2-something

if (flags & (METH_NOARGS | METH_O)) {
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
PyObject *self = PyCFunction_GET_SELF(func);
if (flags & METH_NOARGS && na == 0) {
C_TRACE(x, (*meth)(self,NULL));

x = _Py_CheckFunctionResult(func, x, NULL);
}

The warning in GCC shouldn't probably have been enabled at all in `-Wall 
-Wextra` because the cast is explicit. However, it is somewhat true.

However, the correct way to fix would be to have the METH_NOARGS case cast the 
function to the right prototype. There exists lots of existing code that *is* 
going to break too. 

Perhaps PyCFunction should declare no prototype, i.e. empty parentheses, for 
backwards compatibility:

typedef PyObject *(*PyCFunction)();

and deprecate it; start using a new typedef for it - and then add proper casts 
in every place that call a function.

--

___
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-15 Thread Jay Yin

Jay Yin  added the comment:

https://pastebin.com/q4FKnPZH

the trace for the test_poplib

--

___
Python tracker 

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



[issue33057] logging.Manager.logRecordFactory is never used

2018-03-15 Thread Vinay Sajip

Vinay Sajip  added the comment:

>  I have two types of loggers, one for experiment results ("data") and another 
> for general information

In what way is the behaviour of the two types of logger different? I'm 
concerned that this might be an XY problem ...

--

___
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-15 Thread Jay Yin

Jay Yin  added the comment:

I'm having issues with my local changes for my PR, I'm unsure why my local 
machine takes a seemingly infinite amount of time on test_poplib, so again I 
think something to do with my local environment is causing issues again, any 
help would be appreciated...

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Facundo Batista

Change by Facundo Batista :


--
nosy:  -facundobatista

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Robert Smallshire

Robert Smallshire  added the comment:

Serhiy, you asked for use cases, not uses. The former can exist without the 
latter.  Use cases for is_integer() include all existing uses of x == int(x), 
or other less obvious means of detecting integer values.

Folks try to use x.is_integer(), discover it fails if x is an int, and go in 
search of a replacement, which may well be x == int(x), which goes on to fail 
in more complex and awkward to handle ways with NaN or Inf.

I've seen is_integer() used in guard clauses for functions which accept numbers 
which require an integral value (Recall that explicit type checking is usually 
called out as unPythonic, and rightly so). The Python factorial is example of 
such a function which makes an equivalent check. StackOverflow is awash with 
folks using isinstance(x, int) where that is not what they actually mean. Many 
of these are the same use-case, but don't use is_integer().

I've also seen it used in cases where different algorithms are more optimal 
depending on whether the arguments are integral or not (imagine some 
combination of factorial() and gamma()).

I've seen it used in conversion from float to custom number types used to 
simulate the unusual number types in embedded hardware.

I'm not going to engage with this discussion further. It's already consumed too 
much of my time, left me with a somewhat negative view of how Python 
development proceeds, and a confused view of the values that are most important 
to the Python language.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Stefan Krah

Change by Stefan Krah :


--
nosy:  -skrah

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

If float.is_integer() is useful in numerical code please give me few examples.

I don't take your argument about mpd_as_integer() in the Decimal class. Decimal 
has a lot of methods which makes sense for Decimal.

>>> len(set(dir(decimal.Decimal)) - set(dir(numbers.Rational)))
55

Do you suggests to add all of them into the numeric tower?

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Stefan Krah

Stefan Krah  added the comment:

libmpdec is an example of numerical code.  I don't think anyone but you has 
argued that is_integer() is useless in numerical code.  Whether it is float or 
decimal doesn't matter.

I get the API-bloat argument, but I'm completely surprised that anyone would 
assert the above.


I think searching GitHub or the Internet for robust numerical code is not 
conclusive.  80% of open source stuff is probably derived from netlib anyway. 
:-)



I'll avoid giving examples outside of libmpdec because I don't have time for a 
nitpicking war. :-)

--

___
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-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
dependencies: +Questionable code in OrderedDict definition

___
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-15 Thread Siddhesh Poyarekar

Siddhesh Poyarekar  added the comment:

> I don't have GCC 8 so I cannot verify this bug, but *function pointer casts* 
> are fine - any function pointer can be cast to any other function pointer - 
> it is only that they must *not* be called unless cast back again to be 
> compatible with the function definition. Any fix to the contrary might well 
> *cause* undefined behaviour!

Please see the attached PR; METH_NOARGS callbacks are inconsistent in their 
signature and many have just one argument while they're called with two 
arguments, the second being NULL.  The patch fixes these to consistently take 
and call with two arguments.

> Could you provide a sample of the *actual warnings* so that they could be 
> studied?

Here's one of a few hundred.

Objects/bytesobject.c:3085:25: warning: cast between incompatible function 
types from ‘PyObject * (*)(striterobject *)’ {aka ‘struct _object * (*)(struct 
 *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct 
_object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
 {"__reduce__",  (PyCFunction)striter_reduce, METH_NOARGS,
 ^
This is a new warning in gcc8, so you'll likely not find much reference, but 
here's a gcc bug report that might give you more context:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84531

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

mpd_as_integer() is used internally in the Decimal class. Do you have use cases 
for it outside of the Decimal class?

And the question was about using float.is_integer(). I have not found *any* 
sane example on GitHub. The most harmless is just a demo

>>> x = 3.0
>>> print(x.is_integer())
True

Other examples are so bad that make me angry.

--

___
Python tracker 

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



[issue33073] Add as_integer_ratio() to int() objects

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Adding as_integer_ratio() to numbers.Rational is a breaking change. It breaks 
the interface. Currently all numbers.Rational subclasses implement all public 
methods and properties of the abstract class, but with adding 
as_integer_ratio() this will be no longer true.

>>> issubclass(numpy.int64, numbers.Rational)
True
>>> numpy.int64.as_integer_ratio
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: type object 'numpy.int64' has no attribute 'as_integer_ratio'

I suggest to make as_integer_ratio() creating an implicit interface (as write() 
creates an implicit interface for writable file-like objects), and add a 
convenient function (in the numbers or the math module) which calls this method 
if it exists and falls back to the (nominator, denominator) pair otherwise.

--

___
Python tracker 

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



[issue32608] Incompatibilities with the socketserver and multiprocessing packages

2018-03-15 Thread Michael Durso

Michael Durso  added the comment:

Hi Antoine, no worries for the delay.

I've been looking into why the AppVeyor check is failing.  I believe it to be 
an issue with the test harness in that it changes the environment during the 
tests, but only in the Windows case.  I have been thinking about ignoring the 
failing tests in Windows and create new tests just for the Windows case.  But 
I'm not sure that's the best approach.  Ideally the test harness should be able 
to either not modify the environment of the process or revert the changes it 
has made.

I'm not a strong Windows developer, so with my crude Windows development 
environment I'm struggling to see why the tests work in my Linux dev 
environment but not my Windows VM one.

--

___
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-15 Thread Antti Haapala

Antti Haapala  added the comment:

I don't have GCC 8 so I cannot verify this bug, but *function pointer casts* 
are fine - any function pointer can be cast to any other function pointer - it 
is only that they must *not* be called unless cast back again to be compatible 
with the function definition. Any fix to the contrary might well *cause* 
undefined behaviour!

Could you provide a sample of the *actual warnings* so that they could be 
studied?

--
nosy: +ztane

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Stefan Krah

Stefan Krah  added the comment:

In effect:

   "!(Py_IS_FINITE(dx) && dx == floor(dx))"


I don't understand why Robert is questioned so much. mpd_as_integer() (or 
rather the optimized version _mpd_isint() is used all over the place inside 
libmpdec's own numeric code.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

math.factorial() doesn't use float.is_integer().

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Robert Smallshire

Robert Smallshire  added the comment:

Python in effect contains an example itself. The math.factorial(x) function 
contains what is in-effect an is_integer() check as a guard.

--

___
Python tracker 

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



[issue33042] New 3.7 startup sequence crashes PyInstaller

2018-03-15 Thread Nick Coghlan

Nick Coghlan  added the comment:

Patched test_capi results for 2ebc5ce42a8a9e047e790aefbf9a94811569b2b6 (the 
global state consolidation commit): both pre-initialization tests fail

Patched test_capi results for bab21faded31c70b142776b9a6075a4cda055d7f (the 
immediately preceding commit): both pre-initialization tests pass

Ding, ding, ding, we have a winner :)

Rather than reverting the options-related aspects of that change though, I 
think a nicer way to handle it will be to add a "pre-init fallback" path to 
those functions that stores the raw wchar_t data, and postpones converting 
those values to Py_Unicode objects until we need them in _PyInitialize_Core.

I'm not sure what to do about PySys_AddWarnOptionUnicode though: I think that's 
just outright incoherent as an API, since you need to call it before 
Py_Initialize for it to do anything useful, but we don't support calling any of 
the Unicode creation APIs until *after* Py_Initialize.

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The use case of is_integer() still is not clear. Could you give examples of the 
correct use of this method in real projects?

--

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into the numeric tower and Decimal

2018-03-15 Thread Robert Smallshire

Change by Robert Smallshire :


--
pull_requests: +5885
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



[issue27984] singledispatch register should typecheck its argument

2018-03-15 Thread Xiang Zhang

Xiang Zhang  added the comment:

Cheryl, It's a good remind for me. I totally forget about this issue.

> Since Xiang is a core developer, I thought he would be in the position to 
> make the decision about moving forward with the patch.

Yes, I made the decision. But seems not a wise one, sorry. :-( But fortunately 
Łukasz noticed it. :-)

I am happy to see finally this issue is solved, instead of hanging with no 
reply. :-) Thanks for Łukasz and Cheryl.

I am sorry for the PRs making noise here. Again, it's quite all right for me to 
close them. :-)

--

___
Python tracker 

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



[issue33079] subprocess: document the interaction between subprocess.Popen and os.set_inheritable

2018-03-15 Thread Simon Lipp

New submission from Simon Lipp :

>From current `os` documentation:

> A file descriptor has an “inheritable” flag which indicates if the file 
> descriptor can be inherited by child processes

from current `subprocess` documentation:

> If close_fds is true, all file descriptors except 0, 1 and 2 will be closed 
> before the child process is executed

It would be helpful to explicitly specify that subprocess.Popen does not takes 
into account the inheritable flag ; thas is, that inheritable fds will still be 
closed with open_fds = False, and that non-inheritable fds will still be kept 
with open_fds = True.

--
assignee: docs@python
components: Documentation
messages: 313868
nosy: docs@python, sloonz
priority: normal
severity: normal
status: open
title: subprocess: document the interaction between subprocess.Popen and 
os.set_inheritable
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



[issue32328] ttk.Treeview: _tkinter.TclError: list element in quotes followed by "; " instead of space

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

According to the documentation 
(https://www.tcl.tk/man/tcl/TkCmd/ttk_treeview.htm) the item option "values" is 
"The list of values associated with the item.", and the item option "tags" is 
"A list of tags associated with this item." Tcl's list corresponds Python's 
tuple (lists are also accepted in Python 3).

Change your example to:

kw = {'values': ('" ";',), 'tags': ()}

--

___
Python tracker 

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



[issue33069] Maintainer information discarded when writing PKG-INFO

2018-03-15 Thread Nick Coghlan

Nick Coghlan  added the comment:

We allowed semi-standardised additional fields for an extended period with 1.2 
(for Provides-Extra and Description-Content-Type), but folks mostly found it 
confusingly ambiguous, so Dustin created PEP 566 to define them officially as 
Metadata 1.3.

Given that, I agree with Éric that if distutils is still setting 
"Metadata-Version: 1.1", we should stick with the old PEP 314 behaviour and 
advise folks to migrate to setuptools if they'd prefer the updated behaviour.

--

___
Python tracker 

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



[issue27984] singledispatch register should typecheck its argument

2018-03-15 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Łukasz,

Sorry about that.  Since Xiang is a core developer, I thought he would be in 
the position to make the decision about moving forward with the patch.  I 
apologize for causing unnecessary work.

--

___
Python tracker 

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



[issue32968] Fraction modulo infinity should behave consistently with other numbers

2018-03-15 Thread Mark Dickinson

Mark Dickinson  added the comment:

Yes, that sort of thing is going to happen as soon as floating-point enters the 
mix. There will be surprises from Fraction % float as well as float % Fraction:

>>> from fractions import Fraction
>>> Fraction(10**23) // 1e22
9.0

And that's again surprising, because 1e22 is exactly equal to 10**22:

>>> 1e22 == 10**22
True

This isn't special to Fractions: the same is true for mixed-type int-float 
arithmetic:

>>> 10**23 // 1e22
9.0


As you say, this is the result of rounding error.

There's not much we can do about that except for make sure that people are 
aware that precision can be lost when a Fraction is converted to a float. (One 
could conceivably outlawed mixed-type Fraction-float operations altogether, but 
rightly or wrongly that's not the decision that was made when the Fraction type 
was introduced, and changing that now would amount to gratuitous breakage.)

So yes, modifying both __floordiv__ and __rfloordiv__ together (and similarly 
for __mod__) is the right thing to do: we definitely don't want Fraction % 
float and float % Fraction to return different types.

On the testing front, testing the result value of something like 1.0 // 
Fraction(1, 10) is a little bit dodgy, because the result is only predictable 
under assumptions that we're using IEEE 754 arithmetic, and that's (at the 
moment) not an assumption that the Python core makes. I'd suggest using a safer 
case like 1.0 // Fraction(3, 10).

> I thought about fixing it, to make the behavior more consistent, but I 
> thought that was a bit risky.

I think you have excellent instincts here. :-) But in this case, I do think 
it's better to be consistent, and to have a easy-to-learn and 
simple-to-remember rule (mixed-type Fraction-float arithmetic operations 
convert the Fraction to a float, regardless of the operation or the ordering of 
the operands). The floating-point surprises are a fact of life anyway, 
regardless of what Fraction does.

--

___
Python tracker 

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



[issue32421] Keeping an exception in cache can segfault the interpreter

2018-03-15 Thread Julien Palard

Julien Palard  added the comment:

Serhiy: Sorry the ∈ comes from emacs' pretty-mode, I should copy from outside 
emacs. Version tested are listed in my previous message.

--

___
Python tracker 

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



[issue32421] Keeping an exception in cache can segfault the interpreter

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> for _ ∈ range(5):

What version of Python are you using?

--

___
Python tracker 

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



[issue32799] returned a result with an error set

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What is the full version of Python you used? If this is not 3.6.3 does 
upgrading to 3.6.3 help? Try also with 3.6.4rc1 and the beta of 3.7.

Do you use threads, forking, signal handlers? Is it synchronous or asynchronous 
code? Could you show the code of the function decorated with the contextmanager 
(or asynccontextmanager) decorator and the code that uses this context manager?

With such little information we can fix a bug only by accident, when fixing 
other bugs or during refactoring. And there is a chance that it is already 
fixed in 3.6.3, 3.6.4rc1 or 3.7.

--

___
Python tracker 

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



[issue32825] warn user of creation of multiple Tk instances

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

A warning will harm users that create multiple Tk instances intentionally. If 
it would be always bad, it should raise an error instead of a warning.

--

___
Python tracker 

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



[issue33057] logging.Manager.logRecordFactory is never used

2018-03-15 Thread Ben Feinstein

Ben Feinstein  added the comment:

I use the logging module to log records of lab experiments. I have two
types of loggers, one for experiment results ("data") and another for
general information. I think that having a different managers for data
loggers is the easiest way to do it.

On Thu, Mar 15, 2018, 07:25 Vinay Sajip  wrote:

>
> Vinay Sajip  added the comment:
>
> The logRecordFactory attribute was added but never used and is part of an
> internal API (the Manager isn't documented, on purpose). Why do you need a
> manager-specific factory?
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue32822] finally block doesn't re-raise exception if return statement exists inside

2018-03-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python
status: pending -> open
type: behavior -> enhancement
versions: +Python 2.7, Python 3.6, Python 3.7, Python 3.8 -Python 3.4

___
Python tracker 

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



[issue32822] finally block doesn't re-raise exception if return statement exists inside

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'm not sure that the tutorial should contain such details. But if you provide 
a pull request with a short and clear documenting of this behavior, it will be 
reviewed and may be accepted (not by me, I'm not native English and not tech 
writer). Otherwise this issue will be closed.

--
status: open -> pending

___
Python tracker 

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



[issue32805] Possible integer overflow when call PyDTrace_GC_DONE()

2018-03-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

DTrace support was implemented in issue21590 (changeset 
a785c87d6eacbed81543a8afe3cb098fabb9610a).

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



[issue32757] Python 2.7 : Buffer Overflow vulnerability in exec() function

2018-03-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
type: security -> crash

___
Python tracker 

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



[issue32757] Python 2.7 : Buffer Overflow vulnerability in exec() function

2018-03-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue33036] test_selectors.PollSelectorTestCase failing on macOS 10.13.3

2018-03-15 Thread Nathan Henrie

Nathan Henrie  added the comment:

Thanks for the response -- I'll keep looking, feel free to close since it's
not being reproduced.

```
$ sysctl kern.maxfilesperproc
kern.maxfilesperproc: 64000
$ ./python.exe -c 'import resource;
print(resource.getrlimit(resource.RLIMIT_NOFILE))'
(64000, 524288)
```

Nope, admin access.

--

___
Python tracker 

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



[issue33031] Questionable code in OrderedDict definition

2018-03-15 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
stage:  -> patch review

___
Python tracker 

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



  1   2   >