[issue18844] allow weights in random.choice

2016-09-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: Equidistributed examples: choices(c.execute('SELECT name FROM Employees').fetchall(), k=20) choices(['hearts', 'diamonds', 'spades', 'clubs'], k=5) choices(list(product(card_facevalues, suits)), k=5) Weighted selection examples: Counter(ch

[issue18844] allow weights in random.choice

2016-09-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: ### # Flipping a biased coin from collections import Counter from random import choices print(Counter(choices(range(2), [0.9, 0.1], k=1000))) ###

[issue28207] Use pkg-config to find dependencies

2016-09-26 Thread Chi Hsuan Yen
Chi Hsuan Yen added the comment: Yes pkg-config is not ubiquitous. My idea is using it as a fallback, so that non-standard paths can be picked up easily. > Note the bootstrap issue with that idea though; you'll need to make sure > _posixsubprocess is built before importing subprocess. distuti

[issue28253] calendar.prcal(9999) output has a problem

2016-09-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The patch LGTM except tests. But we should at least document the behavior of itermonthdates(), monthdatescalendar() and yeardatescalendar() at corner cases. -- ___ Python tracker

[issue28207] Use pkg-config to find dependencies

2016-09-26 Thread Kubilay Kocak
Kubilay Kocak added the comment: This (adding support for pkg-config) should be done in tandem with adding --with-foo-{include,library} arguments for each *external* dependency, which can be used for: libffi, readline, libintl, openssl, sqlite, db*, among others. Values obtained from pkg-confi

[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-09-26 Thread Roundup Robot
Roundup Robot added the comment: New changeset 01885f78b299 by Martin Panter in branch '2.7': Issue #26439: Document that RTLD_NOW is always added https://hg.python.org/cpython/rev/01885f78b299 New changeset 0db4403e62c4 by Martin Panter in branch '3.5': Issue #26439: Document that RTLD_NOW is a

[issue28283] test_sock_connect_sock_write_race() of test.test_asyncio.test_selector_events fails randomly on FreeBSD

2016-09-26 Thread STINNER Victor
New submission from STINNER Victor: The issue #28176 introduced a new unit test which fails randomly on FreeBSD buildbots. Recent example: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.x/builds/5162/steps/test/logs/stdio ===

[issue28283] test_sock_connect_sock_write_race() of test.test_asyncio.test_selector_events fails randomly on FreeBSD

2016-09-26 Thread STINNER Victor
STINNER Victor added the comment: Yury: Since you pushed the change adding the test, can you please take a look? If nobody fixes the unit test, I will revert the change. -- ___ Python tracker _

[issue28284] Memory corruption due to size expansion (overflow) in _json.encode_basestring_ascii on 32 bit Python 2.7.12

2016-09-26 Thread Benjamin Peterson
New submission from Benjamin Peterson: Guido Vranken reports: This results in a segmentation fault on 32 bit: python -c "import _json; print _json.encode_basestring_ascii(unicode(chr(0x22)) * 0x2AAB)" This is a tentative patch: diff --git a/Modules/_json.c b/Modules/_json.c index fede6b1

[issue28284] Memory corruption due to size expansion (overflow) in _json.encode_basestring_ascii on 32 bit Python 2.7.12

2016-09-26 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9375c8834448 by Benjamin Peterson in branch '2.7': be extremely careful about overflows in encode_basestring_ascii (closes #28284) https://hg.python.org/cpython/rev/9375c8834448 -- nosy: +python-dev resolution: -> fixed stage: -> resolved

<    1   2