[issue35431] Add a function for computing binomial coefficients to the math module

2019-01-01 Thread Yash Aggarwal


Yash Aggarwal  added the comment:

Thanks @mark.dickinson. As @rhettinger suggested, I'll write a basic function 
that uses division and works in O(k) for now. It's holiday season but hopefully 
@kellerfuchs will respond by then, and in the meantime I'll write more tests 
other than pascal's identity and corner cases.

--

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2019-01-01 Thread Tal Einat


Change by Tal Einat :


--
Removed message: https://bugs.python.org/msg332828

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2019-01-01 Thread Tal Einat


Change by Tal Einat :


--
Removed message: https://bugs.python.org/msg332827

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2019-01-01 Thread Tal Einat


Change by Tal Einat :


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



[issue35632] support unparse for Suite ast

2019-01-01 Thread thautwarm


New submission from thautwarm :

Although `Suite` is not an actual AST used in CPython, it's quite useful when 
performing some code analysis. 

`Suite` is a sequence of statements which could be used to represent a block 
whose context inherits from outside block's.

Also, the document said it's useful in Jython.

I wonder if we could support `unparse` for Suite through making a tiny 
modification to

https://github.com/python/cpython/blob/master/Tools/parser/unparse.py

def _Suite(self, tree):
  for stmt in tree.body:
 self.dispatch(stmt)

--
components: Demos and Tools
messages: 332845
nosy: thautwarm
priority: normal
severity: normal
status: open
title: support unparse for Suite ast
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue35633] test_eintr fails on AIX since fcntl functions were modified

2019-01-01 Thread Michael Felt


New submission from Michael Felt :

test_eintr fails on AIX since fcntl functions were modified
In issue35189 the fnctl() module was modified so that the EINTR interruption 
should be retried automatically.

On AIX the test for flock() passes, but the test for lockf() fails:

 ==
> ERROR: test_lockf (__main__.FNTLEINTRTest)
> --
> Traceback (most recent call last):
>   File "/data/prj/python/git/python3-3.8/Lib/test/eintrdata/eintr_tester.py", 
> line 522, in test_lockf
> self._lock(fcntl.lockf, "lockf")
>   File "/data/prj/python/git/python3-3.8/Lib/test/eintrdata/eintr_tester.py", 
> line 507, in _lock
> lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
> PermissionError: [Errno 13] Permission denied
>

Researching...

--
components: IO, Tests
messages: 332846
nosy: Michael.Felt
priority: normal
severity: normal
status: open
title: test_eintr fails on AIX since fcntl functions were modified
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue35621] asyncio.create_subprocess_exec() only works with main event loop

2019-01-01 Thread Stefan Seefeld


Change by Stefan Seefeld :


--
nosy: +stefan

___
Python tracker 

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



[issue35527] Make fields selectively immutable in dataclasses

2019-01-01 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi @rhettinger, this is similar to #33474.

I started working on an implementation of this.

With the implementation you propose, if a field has both init=True and 
frozen=True, it may be set after the creation of the instance:

@dataclass
class Person:
ssn: int = field(init=False, frozen=True)
name: str

p = Person(name='foo')
p.name = 'bar'
p.ssn = 1234

Wouldn't this conflict with the purpose of safe hashing?

I think it would need __setattr__ to be:

  def __setattr__(self, attr, value):
if attr in {'ssn', 'birth_city'}:
 raise TypeError(
 f'{attr!r} is not settable after initialization')
return super(cls, self).__setattr__(self, name, attr)

wouldn't it?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35577] side_effect mocked method lose reference to instance

2019-01-01 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Is there a problem with:

from unittest import mock

class SomeClass:
def do_something(self, x):
pass

def some_function(x):
obj = SomeClass()
y = obj.do_something(x)
return y

def do_something_side_effect(self, x):
print(self)
return x

def test_some_function():
with mock.patch.object(SomeClass, "do_something", do_something_side_effect):
assert some_function(1)

?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35634] kwargs regression when there are multiple entries with the same key

2019-01-01 Thread iceboy


New submission from iceboy :

Using the multidict package on pypi to illustrate the problem.

Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import multidict
>>> d = multidict.CIMultiDict([('a', 1), ('a', 2)])
>>> def foo(**kwargs): pass
... 
>>> foo(**d)
>>> foo(**{}, **d)

Python 3.6.7 (default, Oct 21 2018, 08:08:16) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import multidict
>>> d = multidict.CIMultiDict([('a', 1), ('a', 2)])
>>> def foo(**kwargs): pass
... 
>>> foo(**d)
>>> foo(**{}, **d)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: foo() got multiple values for keyword argument 'a'

(1) foo(**d)
(2) foo(**{}, **d)

(1) works fine in both versions but (2) only works in Python 3.5 but raises 
TypeError in Python 3.6. This should be a regression. We should either make 
both expressions work or raises error.

--
messages: 332849
nosy: iceboy
priority: normal
severity: normal
status: open
title: kwargs regression when there are multiple entries with the same key
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



[issue35608] python3 multiprocessing queue deadlock when use thread and process at same time

2019-01-01 Thread beruhan


beruhan  added the comment:

I also tested on windows 10,it worked normally.But when I run it under 
ubuntu16.04,It will blocked.my python version is 3.6.5

--

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2019-01-01 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 7e3fb40b923cb09ecc67816d3191197868593737 by Benjamin Peterson 
(Suriyaa ✌️️) in branch 'master':
closes bpo-35630: Use code tag for 'python3' in 'README.rst' (GH-11394)
https://github.com/python/cpython/commit/7e3fb40b923cb09ecc67816d3191197868593737


--
nosy: +benjamin.peterson
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



[issue35630] Missing code tag for "python3" in README.rst

2019-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10779, 10780

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2019-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10777, 10778

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2019-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10777

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2019-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10778, 10779

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2019-01-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10779, 10780, 10781

___
Python tracker 

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



[issue35623] Segfault in test_bigmem.ListTest.test_sort

2019-01-01 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset f8b534477a2a51d85ea1663530f685f805f2b247 by Benjamin Peterson 
(sth) in branch 'master':
closes bpo-35623: Fix integer overflow when sorting large lists (GH-11380)
https://github.com/python/cpython/commit/f8b534477a2a51d85ea1663530f685f805f2b247


--
nosy: +benjamin.peterson
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



[issue35630] Missing code tag for "python3" in README.rst

2019-01-01 Thread miss-islington


miss-islington  added the comment:


New changeset 513fab2c67365e1693216dd59e4df0a5f6bfeb26 by Miss Islington (bot) 
in branch '3.7':
closes bpo-35630: Use code tag for 'python3' in 'README.rst' (GH-11394)
https://github.com/python/cpython/commit/513fab2c67365e1693216dd59e4df0a5f6bfeb26


--
nosy: +miss-islington

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2019-01-01 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset de66b8d498e47ed9d70607ac9b9f72468241da77 by Benjamin Peterson 
(Miss Islington (bot)) in branch '3.6':
closes bpo-35630: Use code tag for 'python3' in 'README.rst' (GH-11400)
https://github.com/python/cpython/commit/de66b8d498e47ed9d70607ac9b9f72468241da77


--

___
Python tracker 

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



[issue35635] asyncio.create_subprocess_exec() only works in main thread

2019-01-01 Thread Stefan Seefeld


New submission from Stefan Seefeld :

This is an addendum to issue35621:

To be able to call `asyncio.create_subprocess_exec()` from another thread, A 
separate event loop needs to be created. To make the child watcher aware of 
this new loop, I have to call `asyncio.get_child_watcher().attach_loop(loop)`. 
However, in the current implementation this call needs to be made by the main 
thread (or else the `signal` module will complain as handlers may only be 
registered in the main thread).

So, to work around the above limitations, the following workflow needs to be 
used:

1) create a new loop in the main thread
2) attach it to the child watcher
3) spawn a worker thread
4) set the previously created event loop as default loop

After that, I can run `asyncio.create_subprocess_exec()` in the worker thread. 
However, I suppose the worker thread will be the only thread able to call that 
function, given the child watcher's limitation to a single loop.

Am I missing something ? Given the complexity of this, I would expect this to 
be better documented in the sections explaining how `asyncio.subprocess` and 
`threading` interact.

--
components: asyncio
messages: 332855
nosy: asvetlov, stefan, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.create_subprocess_exec() only works in main thread
type: behavior

___
Python tracker 

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



[issue35623] Segfault in test_bigmem.ListTest.test_sort

2019-01-01 Thread miss-islington


miss-islington  added the comment:


New changeset a5955b0895aa011b0beff1ceb6539b2ff425 by Miss Islington (bot) 
in branch '3.7':
closes bpo-35623: Fix integer overflow when sorting large lists (GH-11380)
https://github.com/python/cpython/commit/a5955b0895aa011b0beff1ceb6539b2ff425


--
nosy: +miss-islington

___
Python tracker 

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



[issue35636] remove redundant code in unicode_hash(PyObject *self)

2019-01-01 Thread Ma Lin


New submission from Ma Lin :

Please see the PR

--
messages: 332857
nosy: Ma Lin
priority: normal
severity: normal
status: open
title: remove redundant code in unicode_hash(PyObject *self)

___
Python tracker 

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



[issue35636] remove redundant code in unicode_hash(PyObject *self)

2019-01-01 Thread Ma Lin


Change by Ma Lin :


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

___
Python tracker 

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



[issue35636] remove redundant code in unicode_hash(PyObject *self)

2019-01-01 Thread Ma Lin


Change by Ma Lin :


--
keywords: +patch, patch
pull_requests: +10783, 10784
stage:  -> patch review

___
Python tracker 

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



[issue35636] remove redundant code in unicode_hash(PyObject *self)

2019-01-01 Thread Ma Lin


Change by Ma Lin :


--
keywords: +patch, patch, patch
pull_requests: +10783, 10784, 10785
stage:  -> patch review

___
Python tracker 

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



[issue35636] remove redundant code in unicode_hash(PyObject *self)

2019-01-01 Thread Ma Lin


Ma Lin  added the comment:

Every non-empty str will be checked twice at present.

--
components: +Interpreter Core
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



[issue35636] remove redundant code in unicode_hash(PyObject *self)

2019-01-01 Thread Ma Lin


Change by Ma Lin :


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