[issue21720] "TypeError: Item in ``from list'' not a string" message

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

>>> __import__('encodings', fromlist=iter(('aliases', b'foobar')))


--

___
Python tracker 

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



[issue21720] "TypeError: Item in ``from list'' not a string" message

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't think the index in error message is needed. Unlike to str.join() which 
accepts arbitrary iterables of arbitrary names, the fromlist usually is a short 
tuple.

Interesting, what happen if the fromlist is not a list or tuple?

>>> __import__('encodings', fromlist=iter(('aliases', b'codecs')))


Import is successful because the iterator was exhausted by "'*' in fromlist".

--

___
Python tracker 

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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-10-24 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Yes, we could memcpy things around to obtain the desired alignment. It would be 
nicer to have a builtin solution, though.

--

___
Python tracker 

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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2017-10-24 Thread Berker Peksag

Change by Berker Peksag :


--
pull_requests:  -4084

___
Python tracker 

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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2017-10-24 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

In the future, I don't think this sort of thing should be backported.  It isn't 
a bug, rather, it is a "thing x doesn't exactly look like thing y".

--

___
Python tracker 

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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2017-10-24 Thread Antoine Pietri

Change by Antoine Pietri :


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

___
Python tracker 

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



[issue30762] Misleading message “can't concat bytes to str”

2017-10-24 Thread Berker Peksag

Change by Berker Peksag :


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



[issue21720] "TypeError: Item in ``from list'' not a string" message

2017-10-24 Thread Berker Peksag

Change by Berker Peksag :


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



[issue31865] html.unescape does not work as per documentation

2017-10-24 Thread Jun Hui Lee

New submission from Jun Hui Lee :

html.unescape(s)
Convert all named and numeric character references (e.g. , , )

But running this gives:
>>> html.unescape(', , ')
'>, >, '

--
assignee: docs@python
components: Documentation
messages: 304957
nosy: Jun Hui Lee, docs@python
priority: normal
severity: normal
status: open
title: html.unescape does not work as per documentation
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



[issue31845] PYTHONDONTWRITEBYTECODE and PYTHONOPTIMIZE have no effect

2017-10-24 Thread Nick Coghlan

Nick Coghlan  added the comment:

We could still use some more comprehensive test cases for the env var handling 
and the way that interacts with the command line settings, but the merged PR 
includes at least a rudimentary check for the four that directly affect 
sys.flags without any tricky side effects (PYTHONDEBUG, PYTHONVERBOSE, 
PYTHONOPTIMIZE, PYTHONDONTWRITEBYTECODE).

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

___
Python tracker 

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



[issue31845] PYTHONDONTWRITEBYTECODE and PYTHONOPTIMIZE have no effect

2017-10-24 Thread Nick Coghlan

Nick Coghlan  added the comment:


New changeset d7ac06126db86f76ba92cbca4cb702852a321f78 by Nick Coghlan in 
branch 'master':
bpo-31845: Fix reading flags from environment (GH-4105)
https://github.com/python/cpython/commit/d7ac06126db86f76ba92cbca4cb702852a321f78


--

___
Python tracker 

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



[issue21720] "TypeError: Item in ``from list'' not a string" message

2017-10-24 Thread Berker Peksag

Berker Peksag  added the comment:

issue21720_python3.diff hasn't been applied. I'll convert my 
issue21720_python3.diff patch to a pull request. I like the format of Nick's 
"".join() example in msg278794. Here's my proposal for Python 3:

f"Item {i} in 'from list' must be str, not {type(x).__name__!r}"

--
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
versions:  -Python 3.5

___
Python tracker 

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



Re: h5py.File() gives error message

2017-10-24 Thread Rob Gaddi

On 10/24/2017 10:58 AM, C W wrote:

Dear list,

The following Python code gives an error message

# Python code starts here:
import numpy as np
import h5py
train_dataset = h5py.File('datasets/train_catvnoncat.h5', "r")

# Python code ends

The error message:

train_dataset = h5py.File('train_catvnoncat.h5', "r")
Traceback (most recent call last):
   File "", line 1, in 
   File "/Users/M/anaconda/lib/python3.6/site-packages/h5py/_hl/files.py",
line 269, in __init__
 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
   File "/Users/M/anaconda/lib/python3.6/site-packages/h5py/_hl/files.py",
line 99, in make_fid
 fid = h5f.open(name, flags, fapl=fapl)
   File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
   File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
   File "h5py/h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name =
'train_catvnoncat.h5', errno = 2, error message = 'No such file or
directory', flags = 0, o_flags = 0)

My directory is correct, and the dataset folder with file is there.

Why error message? Is it h5py.File() or is it my file? Everything seems
pretty simple, what's going on?

Thank you!



Be 100% sure your directory is correct.  Try it again with an absolute 
path to the file.  Windows makes it far too easy for the working 
directory of a program to be other than what you think it is.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


h5py.File() gives error message

2017-10-24 Thread C W
Dear list,

The following Python code gives an error message

# Python code starts here:
import numpy as np
import h5py
train_dataset = h5py.File('datasets/train_catvnoncat.h5', "r")

# Python code ends

The error message:

train_dataset = h5py.File('train_catvnoncat.h5', "r")
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/M/anaconda/lib/python3.6/site-packages/h5py/_hl/files.py",
line 269, in __init__
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
  File "/Users/M/anaconda/lib/python3.6/site-packages/h5py/_hl/files.py",
line 99, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name =
'train_catvnoncat.h5', errno = 2, error message = 'No such file or
directory', flags = 0, o_flags = 0)

My directory is correct, and the dataset folder with file is there.

Why error message? Is it h5py.File() or is it my file? Everything seems
pretty simple, what's going on?

Thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30768] PyThread_acquire_lock_timed() should recompute the timeout when interrupted by a signal

2017-10-24 Thread STINNER Victor

STINNER Victor  added the comment:

Oh, the pthread condvar+mutex implementation still has the bug, so I reopen the 
issue.

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue30768] PyThread_acquire_lock_timed() should recompute the timeout when interrupted by a signal

2017-10-24 Thread STINNER Victor

STINNER Victor  added the comment:

I merged my PR. Thanks Antoine Pitrou for the review!

This change only impacts the io.BufferedWriter and io.BufferedReader during 
Python finalization. It has no effect on theading.Lock.acquire(). It might 
impact faulthandler.dump_traceback_later(), but in practice, it shouldn't 
change anything since the internal faulthandler watchdog thread blocks all 
signals.

If I understand correctly, if the system clock is stepped back by 1 hour during 
Python finalization, after PyThread_acquire_lock_timed() computed the deadline, 
but before sem_timedwait() completed, _enter_buffered_busy() can be blocked 
during 1 hour.

Moving the system clock backward by 1 hour occurs once a year on the DST 
change. But the race condition is unlikely since the size of the time window is 
only 1 second. The DST change should occur at Python shutdown when an 
io.BufferedReader or io.BufferedWriter is used.

Since the race condition seems very unlikely and was never reported by another 
user, I propose to not backward this change. Moreover, I'm not confident to 
modify locks in a stable release :-)

--

___
Python tracker 

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



[issue30768] PyThread_acquire_lock_timed() should recompute the timeout when interrupted by a signal

2017-10-24 Thread STINNER Victor

Change by STINNER Victor :


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



[issue30768] PyThread_acquire_lock_timed() should recompute the timeout when interrupted by a signal

2017-10-24 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 850a18e03e8f8309bc8c39adc6e7d51a4568cd9a by Victor Stinner in 
branch 'master':
bpo-30768: Recompute timeout on interrupted lock (GH-4103)
https://github.com/python/cpython/commit/850a18e03e8f8309bc8c39adc6e7d51a4568cd9a


--

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-10-24 Thread Elvis Pranskevichus

Elvis Pranskevichus  added the comment:

I think that both the pyiso8601 and boxed/iso8601 implementations parse ISO 
8601 strings incorrectly.  The standard explicitly says that all truncated 
datetime strings are *reduced accuracy timestamps*.  In other words, "2017-10" 
is *not* equal to "2017-10-01".  Instead, "2017-10" represents the whole month 
of October 2017.  Same thing with hours.  Earlier versions of ISO 8601 even 
allowed dropping the year: "--10-01", which meant October 1st of _any year_.  
They dropped this from more recent revisions of the standard.

The only place where the truncated representation means "default to zero" is 
the timezone offset, so "10:10:00+4" and "10:10:00+04:00" mean the same thing.

--
nosy: +Elvis.Pranskevichus

___
Python tracker 

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



[issue31664] Add support of new crypt methods

2017-10-24 Thread STINNER Victor

STINNER Victor  added the comment:

Failure on s390x SLES 3.x:

http://buildbot.python.org/all/#/builders/16/builds/65

==
FAIL: test_invalid_log_rounds (test.test_crypt.CryptTestCase)
--
Traceback (most recent call last):
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/test/test_crypt.py", 
line 60, in test_invalid_log_rounds
self.assertIsNone(crypt.crypt('mypassword', salt))
AssertionError: '*0' is not None

--
nosy: +haypo
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue31803] time.clock() should emit a DeprecationWarning

2017-10-24 Thread STINNER Victor

STINNER Victor  added the comment:

Marc-Andre: "Yes, to avoid yet another Python 2/3 difference. It should be 
replaced with the appropriate variant on Windows and non-Windows platforms. 
From Serhiy's response that's time.process_time() on non-Windows platforms and 
time.perf_counter() on Windows."

I don't understand why you mean by "replaced with". Do you mean modify the 
implementation of the time.clock()?

I would like to kill time.clock() beceause it behaves differently on Windows 
and non-Windows platforms. There are two choices:

* deprecate time.clock() and later remove time.clock() -- it's deprecated since 
Python 3.3, and Python 3.7 now emits a DeprecationWarning
* modify time.clock() to get the same behaviour on all platforms: I proposed to 
modify time.clock() to become a simple alias to time.perf_counter()

Now I'm confused. I'm not sure that I understood what you suggest.

Note: time.clock() already behaves like time.perf_counter() on Windows and 
time.process_time() on non-Windows. It's exactly how it's implemented. But I 
consider that it's a bug, and I want to fix it.


"The documentation can point to the new functions and recommend
these over time.clock()."

It's already done in the doc since Python 3.3, no?

https://docs.python.org/dev/library/time.html#time.clock

"Deprecated since version 3.3: The behaviour of this function depends on the 
platform: use perf_counter() or process_time() instead, depending on your 
requirements, to have a well defined behaviour."

--

___
Python tracker 

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



[issue31864] datetime violates Postel's law

2017-10-24 Thread Ned Deily

Change by Ned Deily :


--
resolution:  -> third party
status: open -> closed

___
Python tracker 

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



Re: Compression of random binary data

2017-10-24 Thread Richard Damon

On 10/24/17 6:30 PM, Steve D'Aprano wrote:

On Wed, 25 Oct 2017 07:09 am, Peter J. Holzer wrote:


On 2017-10-23 04:21, Steve D'Aprano  wrote:

On Mon, 23 Oct 2017 02:29 pm, Stefan Ram wrote:



If the probability of certain codes (either single codes, or sequences of
codes) are non-equal, then you can take advantage of that by encoding the
common cases into a short representation, and the uncommon and rare cases
into a longer representation. As you say:



   Otherwise, if ( 0, 0 ) is much more frequent,
   we can encode ( 0, 0 ) by "0" and

( 0, 1 ) by "101",
( 1, 0 ) by "110", and
( 1, 1 ) by "111".

   And we could then use /less/ than two bits on the
   average.


That's incorrect. On average you use 2.5 bits.

(1*1 bit + 3*3 bits divide by four possible outcomes, makes 2.5 bits.)


I disagree. If the distribution is not equal, then the average needs to
take the different probabilities into account.


I think I would call that the *weighted* average rather than the average.

Regardless of what we call it, of course both you and Stefan are right in how
to calculate it, and such a variable-length scheme can be used to compress
the data.

E.g. given the sequence 0011 which would take 8 bits in the obvious
encoding, we can encode it as "000111" which takes only 6 bits.

But the cost of this encoding scheme is that *some* bit sequences expand, e.g.
the 8 bit sequence 1100 is encoded as "10" which requires 10
bits.

The end result is that averaged over all possible bit sequences (of a certain
size), this encoding scheme requires MORE space than the obvious 0/1 bits.

But in practice we don't care much, because the data sequences we care about
are usually not "all possible bit sequences", but a heavily restricted subset
where there are lots of 00 pairs and fewer 01, 10, and 11 pairs.



My understanding of the 'Random Data Comprehensibility' challenge is 
that is requires that the compression take ANY/ALL strings of up to N 
bits, and generate an output stream no longer than the input stream, and 
sometime less. It admits that given no-uniformly distributed data, it is 
possible to compress some patterns, the common ones, and expand others, 
the uncommon ones, to lower the net average length. What it says can't 
be done is to have a compression method that compresses EVERY input 
pattern. That is where the 'Pigeon Hole' principle comes into play which 
the people who claim to be able to compress random data like to ignore 
or just attempt to say doesn't apply.


--
https://mail.python.org/mailman/listinfo/python-list


[issue31864] datetime violates Postel's law

2017-10-24 Thread Geoff Kuenning

Geoff Kuenning  added the comment:

Duh, my mistake.  The problem is in dateutil, which AFAICT is indeed not part 
of the Python standard library.  I'll hang my head in shame and go report the 
problem in the right place.

--
resolution: third party -> 
status: closed -> open

___
Python tracker 

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



Re: Compression of random binary data

2017-10-24 Thread Chris Angelico
On Wed, Oct 25, 2017 at 9:11 AM, Steve D'Aprano
 wrote:
> On Wed, 25 Oct 2017 02:40 am, Lele Gaifax wrote:
>
>> Steve D'Aprano  writes:
>>
>>> But given an empty file, how do you distinguish the empty file you get
>>> from 'music.mp3' and the identical empty file you get from 'movie.avi'?
>>
>> That's simple enough: of course one empty file would be
>> "music.mp3.zip.zip.zip", while the other would be
>> "movie.avi.zip.zip.zip.zip.zip"... some sort of
>> https://en.wikipedia.org/wiki/Water_memory applied to file system entries
>> :-)
>
>
> Does that mean if I name an empty file
>
> serenity2-by-joss-whedon.avi.zip.zip.zip.zip.zip
>
> Dancerswithnumbers' magic algorithm will recreate the movie from some
> alternative universe where it actually exists?
>
> Awesome.

Yes, but then you'd get
dmca-takedown-request.pdf.zip.zip.zip.zip.zip.zip.zip which would also
be empty.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31864] datetime violates Postel's law

2017-10-24 Thread R. David Murray

R. David Murray  added the comment:

I meant the python standard library datetime package doesn't parse files, of 
course :)  Other parts of the stdlib certainly do parse files.

--

___
Python tracker 

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



[issue31864] datetime violates Postel's law

2017-10-24 Thread R. David Murray

R. David Murray  added the comment:

The python standard library does not parse files, nor does it have a _parse_rfc 
message. You say you reported the problem you are having to "the program's 
maintainer", and that is appropriate.  There does not appear to be anything in 
this report related to the python standard library, which is what would be 
appropriate for this bug tracker.

--
nosy: +r.david.murray
resolution:  -> third party
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



[issue31864] datetime violates Postel's law

2017-10-24 Thread Geoff Kuenning

Change by Geoff Kuenning :


--
components: +Library (Lib)
type:  -> behavior
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



[issue31864] datetime violates Postel's law

2017-10-24 Thread Geoff Kuenning

New submission from Geoff Kuenning :

The datetime package is too eager to reject nonconforming VCALENDAR-format 
files.  The particular issue I encountered is related to time zones.  RFC 5545 
clearly states that the DTSTART field is required.  However, there are 
situations where DTSTART isn't strictly necessary because the zone in question 
doesn't observe daylight-savings time and never has.

For example, I have a VCALENDAR file that was generated by a program that omits 
DTSTART for such zones.  Here's an example:

BEGIN:VTIMEZONE
TZID:America/Phoenix
X-LIC-LOCATION:America/Phoenix
BEGIN:DAYLIGHT
TZOFFSETFROM:-0700
TZOFFSETTO:-0700
TZNAME:Ariz
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0700
TZNAME:Ariz
END:STANDARD
END:VTIMEZONE

Clearly, this file violates RFC 5445, and I have reported that fact to the 
program's maintainer (who will fix the problem soon).  Nevertheless, feeding an 
ICS file to datetime._parse_rfc with this error causes a ValueError exception, 
which makes the VCALENDAR file unreadable.

In keeping with Postel's law ("Be conservative in what you do, be liberal in 
what you accept from others"), _parse_rfc should attempt to accept VCALENDAR 
files whenever it is possible to make sense of them.  Thus, for example:

if not founddtstart:
rrulelines.append('DTSTART:19000101T02')

The above could be improved a bit, for example by still rejecting entries in 
which the standard and daylight sections had different offsets (although even 
then it seems valid to assume a DTSTART in the distant past).

Although the dtstart issue is the one that prompted this report, I also noticed 
the following in _parse_rfc:

if name == "BEGIN":
if value in ("STANDARD", "DAYLIGHT"):
# Process component
pass
else:
raise ValueError("unknown component: "+value)

Again, there's an opportunity to be more robust here.  One could issue a 
warning message, but then ignore the unknown component.

In both cases (and I suspect numerous others), halting parsing is an extreme 
response to various errors, since it leaves the user of the package with no way 
to process a nonconforming file.  That's especially problematic since VCALENDAR 
files are generated by so many different programs, many of which are written by 
programmers who haven't bothered to read RFC 5445--or who have read it but then 
made some minor mistake that produces broken files.

--
messages: 304944
nosy: gkuenning
priority: normal
severity: normal
status: open
title: datetime violates Postel's law

___
Python tracker 

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



Re: Compression of random binary data

2017-10-24 Thread Steve D'Aprano
On Wed, 25 Oct 2017 07:09 am, Peter J. Holzer wrote:

> On 2017-10-23 04:21, Steve D'Aprano  wrote:
>> On Mon, 23 Oct 2017 02:29 pm, Stefan Ram wrote:
>>>
>> If the probability of certain codes (either single codes, or sequences of
>> codes) are non-equal, then you can take advantage of that by encoding the
>> common cases into a short representation, and the uncommon and rare cases
>> into a longer representation. As you say:
>>
>>
>>>   Otherwise, if ( 0, 0 ) is much more frequent,
>>>   we can encode ( 0, 0 ) by "0" and
>>> 
>>> ( 0, 1 ) by "101",
>>> ( 1, 0 ) by "110", and
>>> ( 1, 1 ) by "111".
>>> 
>>>   And we could then use /less/ than two bits on the
>>>   average.
>>
>> That's incorrect. On average you use 2.5 bits.
>>
>> (1*1 bit + 3*3 bits divide by four possible outcomes, makes 2.5 bits.)
> 
> I disagree. If the distribution is not equal, then the average needs to
> take the different probabilities into account.

I think I would call that the *weighted* average rather than the average.

Regardless of what we call it, of course both you and Stefan are right in how
to calculate it, and such a variable-length scheme can be used to compress
the data.

E.g. given the sequence 0011 which would take 8 bits in the obvious
encoding, we can encode it as "000111" which takes only 6 bits.

But the cost of this encoding scheme is that *some* bit sequences expand, e.g.
the 8 bit sequence 1100 is encoded as "10" which requires 10
bits.

The end result is that averaged over all possible bit sequences (of a certain
size), this encoding scheme requires MORE space than the obvious 0/1 bits.

But in practice we don't care much, because the data sequences we care about
are usually not "all possible bit sequences", but a heavily restricted subset
where there are lots of 00 pairs and fewer 01, 10, and 11 pairs.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2017-10-24 Thread Steve D'Aprano
On Wed, 25 Oct 2017 02:40 am, Lele Gaifax wrote:

> Steve D'Aprano  writes:
> 
>> But given an empty file, how do you distinguish the empty file you get
>> from 'music.mp3' and the identical empty file you get from 'movie.avi'?
> 
> That's simple enough: of course one empty file would be
> "music.mp3.zip.zip.zip", while the other would be
> "movie.avi.zip.zip.zip.zip.zip"... some sort of
> https://en.wikipedia.org/wiki/Water_memory applied to file system entries
> :-)


Does that mean if I name an empty file 

serenity2-by-joss-whedon.avi.zip.zip.zip.zip.zip

Dancerswithnumbers' magic algorithm will recreate the movie from some
alternative universe where it actually exists?

Awesome.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2017-10-24 Thread Ian Kelly
On Tue, Oct 24, 2017 at 12:20 AM, Gregory Ewing
 wrote:
> danceswithnumb...@gmail.com wrote:
>>
>> I did that quite a while ago. 352,954 kb.
>
>
> Are you sure? Does that include the size of all the
> code, lookup tables, etc. needed to decompress it?

My bet is that danceswithnumbers does indeed have a file of that size
which is in some way derived from the million random digits, but
without any means of losslessly "decompressing" it (thus making it
junk data).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2017-10-24 Thread Peter Pearson
On Tue, 24 Oct 2017 14:51:37 +1100, Steve D'Aprano wrote:
  On Tue, 24 Oct 2017 01:27 pm, danceswithnumb...@gmail.com wrote:
  > Yes! Decode reverse is easy..sorry so excited i could shout.

  Then this should be easy for you:

  http://marknelson.us/2012/10/09/the-random-compression-challenge-turns-ten/

  All you need to do is compress this file:

  
http://marknelson.us/attachments/million-digit-challenge/AMillionRandomDigits.bin

  to less than 415241 bytes, and you can win $100.

Then, on Mon, 23 Oct 2017 21:13:00 -0700 (PDT), danceswithnumbers wrote:
> I did that quite a while ago. 


But 352,954 kb > 415241 bytes, by several orders of magnitude; so
you didn't "do that".  (Or are we using the European decimal point?)

If you're claiming 352,954 *bytes*, not kb, I invite you to explain
why you have not collected Mark Nelson's $100 prize, and untold fame
and glory; failing which, your credibility will evaporate.

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25172] Unix-only crypt should not be present on Windows.

2017-10-24 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.7 -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



[issue28503] [Patch] '_crypt' module: fix implicit declaration of crypt(), use crypt_r() where available

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What is the performance of crypt_r() in comparison with crypt()?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31702] Allow to specify the number of rounds for SHA-* hashing in crypt

2017-10-24 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

I'd raise a ValueError in that case.

--

___
Python tracker 

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



[issue31803] time.clock() should emit a DeprecationWarning

2017-10-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

On 24.10.2017 11:23, STINNER Victor wrote:
> 
> Marc-Andre Lemburg: "Thanks for pointing that out. I didn't know."
> 
> Do you still think that we need to modify time.clock() rather than 
> deprecating it?

Yes, to avoid yet another Python 2/3 difference. It should be
replaced with the appropriate variant on Windows
and non-Windows platforms. From Serhiy's response that's
time.process_time() on non-Windows platforms and time.perf_counter()
on Windows.

The documentation can point to the new functions and recommend
these over time.clock().

--

___
Python tracker 

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



[issue25287] test_crypt fails on OpenBSD

2017-10-24 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



[issue25287] test_crypt fails on OpenBSD

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 04c0a4038e8764f742de8505600b8ee97ee50776 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-25287: Backport new tests for crypt and skip test_crypt on OpenBSD. 
(GH-4111). (#4112)
https://github.com/python/cpython/commit/04c0a4038e8764f742de8505600b8ee97ee50776


--

___
Python tracker 

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



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-24 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



[issue31690] Make RE "a", "L" and "u" inline flags local

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 3557b05c5a7dfd7d97ddfd3b79aefd53d25e5132 by Serhiy Storchaka in 
branch 'master':
bpo-31690: Allow the inline flags "a", "L", and "u" to be used as group flags 
for RE. (#3885)
https://github.com/python/cpython/commit/3557b05c5a7dfd7d97ddfd3b79aefd53d25e5132


--

___
Python tracker 

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



[issue25287] test_crypt fails on OpenBSD

2017-10-24 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4082

___
Python tracker 

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



[issue25287] test_crypt fails on OpenBSD

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset f52dff611cff2fb9e90340b4787eda50ab2d40c6 by Serhiy Storchaka in 
branch '3.6':
bpo-25287: Backport new tests for crypt and skip test_crypt on OpenBSD. (#4111)
https://github.com/python/cpython/commit/f52dff611cff2fb9e90340b4787eda50ab2d40c6


--

___
Python tracker 

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



Re: Compression of random binary data

2017-10-24 Thread Peter J. Holzer
On 2017-10-23 04:21, Steve D'Aprano  wrote:
> On Mon, 23 Oct 2017 02:29 pm, Stefan Ram wrote:
>>
> If the probability of certain codes (either single codes, or sequences of
> codes) are non-equal, then you can take advantage of that by encoding the
> common cases into a short representation, and the uncommon and rare cases
> into a longer representation. As you say:
>
>
>>   Otherwise, if ( 0, 0 ) is much more frequent,
>>   we can encode ( 0, 0 ) by "0" and
>> 
>> ( 0, 1 ) by "101",
>> ( 1, 0 ) by "110", and
>> ( 1, 1 ) by "111".
>> 
>>   And we could then use /less/ than two bits on the
>>   average. 
>
> That's incorrect. On average you use 2.5 bits.
>
> (1*1 bit + 3*3 bits divide by four possible outcomes, makes 2.5 bits.)

I disagree. If the distribution is not equal, then the average needs to
take the different probabilities into account. 

Let's assume that (0, 0) has a probability of 90 %, (0, 1) a probability
of 10 % and (1, 0) and (1, 1) a probability of 5 % each. 

Then the average length is 

0.9 * 1 bit + 0.1 * 3 bits + 0.05 * 3 bits + 0.05 * 3 bits = 1.5 bits.

hp


-- 
   _  | Peter J. Holzer| Fluch der elektronischen Textverarbeitung:
|_|_) || Man feilt solange an seinen Text um, bis
| |   | h...@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Keep islice() non-converted. For the r parameter of permutations() use "r: 
object = None".

--

___
Python tracker 

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



[issue25287] test_crypt fails on OpenBSD

2017-10-24 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4081
stage:  -> patch review

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-10-24 Thread Tal Einat

Tal Einat  added the comment:

What about islice? Does AC now support complex enough signatures to support it? 
If not, should I leave the comment as is?

--

___
Python tracker 

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



Re: right list for SIGABRT python binary question ?

2017-10-24 Thread M.-A. Lemburg


On 22.10.2017 22:15, Karsten Hilbert wrote:
> On Sat, Oct 21, 2017 at 07:10:31PM +0200, M.-A. Lemburg wrote:
> 
>>> Running a debug build of py27 gave me a first lead: this
>>> Debian system (Testing, upgraded all the way from various
>>> releases ago) carries an incompatible mxDateTime which I'll
>>> take care of.
>>>
>>> *** You don't have the (right) mxDateTime binaries installed !
>>> Traceback (most recent call last):
>>>   File "./bootstrap_gm_db_system.py", line 87, in 
>>> from Gnumed.pycommon import gmCfg2, gmPsql, gmPG2, gmTools, gmI18N
>>>   File 
>>> "/home/ncq/Projekte/gm-git/gnumed/gnumed/Gnumed/pycommon/gmPG2.py", line 
>>> 34, in 
>>> from Gnumed.pycommon import gmDateTime
>>>   File 
>>> "/home/ncq/Projekte/gm-git/gnumed/gnumed/Gnumed/pycommon/gmDateTime.py", 
>>> line 52, in 
>>> import mx.DateTime as mxDT
>>>   File "/usr/lib/python2.7/dist-packages/mx/DateTime/__init__.py", line 
>>> 8, in 
>>> from DateTime import *
>>>   File "/usr/lib/python2.7/dist-packages/mx/DateTime/DateTime.py", line 
>>> 9, in 
>>> from mxDateTime import *
>>>   File 
>>> "/usr/lib/python2.7/dist-packages/mx/DateTime/mxDateTime/__init__.py", line 
>>> 13, in 
>>> raise ImportError, why
>>> ImportError: 
>>> /usr/lib/python2.7/dist-packages/mx/DateTime/mxDateTime/mxDateTime.so: 
>>> undefined symbol: Py_InitModule4
>>
>> This error suggests that you have 32- and 64-bit versions of
>> Python and mxDateTime mixed in your installation.
>>
>> Py_InitModule4 is only available in the 32-bit build of
>> Python. With the 64-bit build, it's called Py_InitModule4_64.
>>
>> Since you're getting the same error from faulthandler,
>> this is where I'd start to investigate.
>>
>> "nm" will list all exported and required symbols. As first step,
>> you should probably check the python binary for its symbols and
>> see whether it exports Py_InitModule* symbols.
> 
> Thanks for your input !
> 
> The python2.7-dbg build is 32 bits:
> 
>   root@hermes:~# nm /usr/bin/python2.7-dbg | grep Py_InitM
>   00155b9f T Py_InitModule4TraceRefs
> 
> 
>   python2.7-dbg:
> Installiert:   2.7.14-2
> Installationskandidat: 2.7.14-2
> Versionstabelle:
>*** 2.7.14-2 500
>   500 http://httpredir.debian.org/debian unstable/main i386 
> Packages
>   100 /var/lib/dpkg/status
>2.7.13-2 990
>   500 http://httpredir.debian.org/debian stretch/main i386 
> Packages
>   990 http://httpredir.debian.org/debian buster/main i386 Packages
> 
> The python2.7 build (no -dbg) does not have symbols.
> 
> mxDateTime really should be 32 bits, too:
> 
>   python-egenix-mxdatetime:
> Installiert:   3.2.9-1
> Installationskandidat: 3.2.9-1
> Versionstabelle:
>*** 3.2.9-1 990
>   500 http://httpredir.debian.org/debian stretch/main i386 
> Packages
>   990 http://httpredir.debian.org/debian buster/main i386 Packages
>   500 http://httpredir.debian.org/debian unstable/main i386 
> Packages
>   100 /var/lib/dpkg/status
> 
> Let me check the .so file:
> 
>   root@hermes:~# nm 
> /usr/lib/python2.7/dist-packages/mx/DateTime/mxDateTime/mxDateTime_d.so  | 
> grep Py_InitM
>U Py_InitModule4TraceRefs
> 
> It seems it is - hm ...

Could you check whether you have similar import errors with
other modules that have C extensions ? E.g. lxml.

What you're seeing appears to be a compilation problem
with Python 2.7.14 on Debian. The executable doesn't appear
to export its symbols to the .so files, or only some of them.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> Python Database Interfaces ...   http://products.egenix.com/
>>> Plone/Zope Database Interfaces ...   http://zope.egenix.com/


: Try our mxODBC.Connect Python Database Interface for free ! ::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

All correct. The final patch should be in the form of GitHub PR.

Don't specify the self parameter explicitly, just rename the corresponding 
variable. The rest of the patch LGTM.

--

___
Python tracker 

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



[issue9305] Don't use east/west of UTC in date/time documentation

2017-10-24 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Would one of the original authors of the patches like to create a GitHub pull 
request for this issue?

--
nosy: +csabella

___
Python tracker 

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



[issue31702] Allow to specify the number of rounds for SHA-* hashing in crypt

2017-10-24 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue28281] Remove year limits from calendar

2017-10-24 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I submitted Mark's patch unchanged as PR 4109.  If we don't hear from Mark, I 
will address my own comments and merge.

--

___
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

2017-10-24 Thread Tal Einat

Tal Einat  added the comment:

I'd be happy to update the patches.

I asked for a bit of clarification on what this entails in msg304931 on issue 
#20180, once that's clear I'll do the same for these patches and create PRs.

--

___
Python tracker 

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



[issue28281] Remove year limits from calendar

2017-10-24 Thread Alexander Belopolsky

Change by Alexander Belopolsky :


--
pull_requests: +4079
stage: commit review -> patch review

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-10-24 Thread Tal Einat

Tal Einat  added the comment:

Id be happy to update the itertools patch.

I haven't been following AC work for quite a while. I would expect this to 
entail:

1. applying the patch to the master branch
2. merging any conflicts
3. running the clinic.py script again
4. review the output and compare it to the previous output to make sure things 
look okay

Would you also prefer this in the form of a GitHub PR?

--

___
Python tracker 

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



[issue28292] Make Calendar.itermonthdates() behave consistently in edge cases

2017-10-24 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:


New changeset fdd9b217c60b454ac6a82f02c8b0b551caeac88b by Alexander Belopolsky 
in branch 'master':
Closes bpo-28292: Implemented Calendar.itermonthdays3() and itermonthdays4(). 
(#4079)
https://github.com/python/cpython/commit/fdd9b217c60b454ac6a82f02c8b0b551caeac88b


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



[issue25287] test_crypt fails on OpenBSD

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

issue31664 fixes test_crypt in 3.7. In other versions the test should be just 
skipped on OpenBSD. Blowfish is the only method supported on OpenBSD, but it 
was not supported by the Python's crypt module.

--

___
Python tracker 

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



[issue14518] Add bcrypt $2a$ to crypt.py

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The support of the Blowfish hashing (prefix '$2a$') has been added in 
issue31664.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage: needs patch -> resolved
status: pending -> closed
superseder:  -> Add support of new crypt methods

___
Python tracker 

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



[issue31664] Add support of new crypt methods

2017-10-24 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



[issue31664] Add support of new crypt methods

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset eab3ff72ebe79416cc032b8508ae13332955a157 by Serhiy Storchaka in 
branch 'master':
bpo-31664: Add support for the Blowfish method in crypt. (#3854)
https://github.com/python/cpython/commit/eab3ff72ebe79416cc032b8508ae13332955a157


--

___
Python tracker 

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



[issue31861] aiter() and anext() built-in functions

2017-10-24 Thread Yury Selivanov

Yury Selivanov  added the comment:

> No, just this tracker issue, a PR and a reviewer. (Sorry, I can't review
CPython code myself any more.)

Alright, I'll work on a PR after PEP 55x.

--

___
Python tracker 

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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-10-24 Thread Stefan Krah

Stefan Krah  added the comment:

Since we have "#define PYMEM_FUNCS PYOBJ_FUNCS", I think extensions that
use PyMem_Malloc() also won't get the glibc max_align_t alignment.

But guess technically they should.

--
nosy: +skrah

___
Python tracker 

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



[issue31861] aiter() and anext() built-in functions

2017-10-24 Thread Guido van Rossum

Guido van Rossum  added the comment:

> do we need a PEP to add aiter() and anext() builtins?

No, just this tracker issue, a PR and a reviewer. (Sorry, I can't review
CPython code myself any more.)

--

___
Python tracker 

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



[issue31861] aiter() and anext() built-in functions

2017-10-24 Thread Yury Selivanov

Yury Selivanov  added the comment:

Guido, do we need a PEP to add aiter() and anext() builtins?

--

___
Python tracker 

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



[issue31861] aiter() and anext() built-in functions

2017-10-24 Thread Davide Rizzo

Change by Davide Rizzo :


--
nosy: +gvanrossum, yselivanov

___
Python tracker 

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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-10-24 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Can we use memcpy()?

Hmm, perhaps.  Do you want to try it out (and measure any performance 
degradation)?

--

___
Python tracker 

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



[issue31299] Add "ignore_modules" option to TracebackException.format()

2017-10-24 Thread Dmitry Kazakov

Dmitry Kazakov  added the comment:

Ping. (this issue needs a decision on ignore_modules vs filter callback, and/or 
patch review)

--

___
Python tracker 

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



[issue31863] Inconsistent returncode/exitcode for terminated child processes on Windows

2017-10-24 Thread Akos Kiss

New submission from Akos Kiss :

I've been working with various approaches for running and terminating 
subprocesses on Windows and I've obtained surprisingly different results if I 
used different modules and ways of termination. Here is the script I wrote, it 
uses the `subprocess` and the `multiprocessing` modules for starting new 
subprocesses, and process termination is performed either by the modules' own 
`terminate` functions or by `os.kill`.

```py
import multiprocessing
import os
import signal
import subprocess
import sys
import time

def kill_with_os_kill(proc):
print('kill with os.kill(pid,SIGTERM)')
os.kill(proc.pid, signal.SIGTERM)

def kill_with_terminate(proc):
print('kill child with proc.terminate()')
proc.terminate()

def run_and_kill_subprocess(killfn, procarg):
print('run subprocess child with %s' % procarg)
with subprocess.Popen([sys.executable, __file__, procarg]) as proc:
time.sleep(1)
killfn(proc)
proc.wait()
print('child terminated with %s' % proc.returncode)

def run_and_kill_multiprocessing(killfn, procarg):
print('run multiprocessing child with %s' % procarg)
proc = multiprocessing.Process(target=childmain, args=(procarg,))
proc.start()
time.sleep(1)
killfn(proc)
proc.join()
print('child terminated with %s' % proc.exitcode)

def childmain(arg):
print('child process started with %s' % arg)
while True:
pass

if __name__ == '__main__':
if len(sys.argv) < 2:
print('parent process started')
run_and_kill_subprocess(kill_with_os_kill, 'subprocess-oskill')
run_and_kill_subprocess(kill_with_terminate, 'subprocess-terminate')
run_and_kill_multiprocessing(kill_with_os_kill, 
'multiprocessing-oskill')
run_and_kill_multiprocessing(kill_with_terminate, 
'multiprocessing-terminate')
else:
childmain(sys.argv[1])
```

On macOS, everything works as expected (and I think that Linux will behave 
alike):

```
$ python3 killtest.py 
parent process started
run subprocess child with subprocess-oskill
child process started with subprocess-oskill
kill with os.kill(pid,SIGTERM)
child terminated with -15
run subprocess child with subprocess-terminate
child process started with subprocess-terminate
kill child with proc.terminate()
child terminated with -15
run multiprocessing child with multiprocessing-oskill
child process started with multiprocessing-oskill
kill with os.kill(pid,SIGTERM)
child terminated with -15
run multiprocessing child with multiprocessing-terminate
child process started with multiprocessing-terminate
kill child with proc.terminate()
child terminated with -15
```

But on Windows, I got:

```
>py -3 killtest.py
parent process started
run subprocess child with subprocess-oskill
child process started with subprocess-oskill
kill with os.kill(pid,SIGTERM)
child terminated with 15
run subprocess child with subprocess-terminate
child process started with subprocess-terminate
kill child with proc.terminate()
child terminated with 1
run multiprocessing child with multiprocessing-oskill
child process started with multiprocessing-oskill
kill with os.kill(pid,SIGTERM)
child terminated with 15
run multiprocessing child with multiprocessing-terminate
child process started with multiprocessing-terminate
kill child with proc.terminate()
child terminated with -15
```

Notes:
- On Windows with `os.kill(pid, sig)`, "sig will cause the process to be 
unconditionally killed by the TerminateProcess API, and the exit code will be 
set to sig." I.e., it is not possible to detect on Windows whether a process 
was terminated by a signal or it exited properly, because `kill` does not 
actually raise a signal and no Windows API allows to differentiate between 
proper or forced termination.
- The `multiprocessing` module has a workaround for this by terminating the 
process with a designated exit code (`TERMINATE = 0x1`) and checking for 
that value afterwards, rewriting it to `-SIGTERM` if found. The related 
documentation is a bit misleading, as `exitcode` is meant to have "negative 
value -N [which] indicates that the child was terminated by signal N" -- 
however, if the process was indeed killed with `SIGTERM` (and not via 
`terminate`), then `exitcode` will be `SIGTERM` and not `-SIGTERM` (see above). 
(The documentation of `terminate` does not clarify the situation much by 
stating that "on Windows TerminateProcess() is used", since it does not mention 
the special exit code -- and well, it's not even a signal after all, so it's 
not obvious whether negative or positive exit code is to be expected.)
- The `subprocess` module choses the quite arbitrary exit code of 1 and 
documents that "negative value -N indicates that the child was terminated by 
signal N" is POSIX only, not mentioning anything about what to expect on 
Windows.

Long story short: on Windows, the observable exit code of a forcibly terminated 
child process is quite 

Re: Compression of random binary data

2017-10-24 Thread Tim Golden

On 24/10/2017 16:40, Lele Gaifax wrote:

Steve D'Aprano  writes:


But given an empty file, how do you distinguish the empty file you get
from 'music.mp3' and the identical empty file you get from 'movie.avi'?


That's simple enough: of course one empty file would be
"music.mp3.zip.zip.zip", while the other would be


I swear this looks like the lyrics of something or another...

"Music MP3 - zip - zip - zip"

TJG
--
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2017-10-24 Thread Lele Gaifax
Steve D'Aprano  writes:

> But given an empty file, how do you distinguish the empty file you get
> from 'music.mp3' and the identical empty file you get from 'movie.avi'?

That's simple enough: of course one empty file would be
"music.mp3.zip.zip.zip", while the other would be
"movie.avi.zip.zip.zip.zip.zip"... some sort of
https://en.wikipedia.org/wiki/Water_memory applied to file system entries :-)

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  | -- Fortunato Depero, 1929.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-10-24 Thread STINNER Victor

STINNER Victor  added the comment:

Change by Antoine Pitrou: "versions:  -Python 2.7, Python 3.3, Python 3.4, 
Python 3.5, Python 3.6"

The undefined behaviour exists and should be fixed in Python 2.7 and 3.6, no? 
Can we use memcpy()?

--

___
Python tracker 

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



Re: choice of web-framework

2017-10-24 Thread John Black
In article , 
ros...@gmail.com says...
> 
> On Tue, Oct 24, 2017 at 6:57 AM, Chris Warrick  wrote:
> > On 23 October 2017 at 21:37, John Black  wrote:
> >> Chris, thanks for all this detailed information.  I am confused though
> >> with your database recommendation.  You say you teach SQLAlchemy but
> >> generally use PostgreSQL yourself.  I can maybe guess why there seems to
> >> be this contradiction.  Perhaps PostgreSQL is better but too advanced for
> >> the class you are teaching?  Can you clarify on which you think is the
> >> better choice?  Thanks.
> >
> > Different Chris, but I?ll answer. Those are two very different things.
> >
> > PostgreSQL is a database server. It talks SQL to clients, stores data,
> > retrieves it when asked. The usual stuff a database server does.
> > Alternatives: SQLite, MySQL, MS SQL, Oracle DB, ?
> >
> > SQLAlchemy is an ORM: an object-relational mapper, and also a database
> > toolkit. SQLAlchemy can abstract multiple database servers/engines
> > (PostgreSQL, SQLite, MySQL, etc.) and work with them from the same
> > codebase. It can also hide SQL from you and instead give you Python
> > classes. If you use an ORM like SQLAlchemy, you get database support
> > without writing a single line of SQL on your own. But you still need a
> > database engine ? PostgreSQL can be one of them. But you can deploy
> > the same code to different DB engines, and it will just work?
> > (assuming you didn?t use any DB-specific features). Alternatives:
> > Django ORM.
> >
> > psycopg2 is an example of a PostgreSQL client library for Python. It
> > implements the Python DB-API and lets you use it to talk to a
> > PostgreSQL server. When using psycopg2, you?re responsible for writing
> > your own SQL statements for the server to execute. In that approach,
> > you?re stuck with PostgreSQL and psycopg2 unless you rewrite your code
> > to be compatible with the other database/library. Alternatives (other
> > DBs): sqlite3, mysqlclient. There are also other PostgreSQL libraries
> > available.
> >
> 
> Thanks, namesake :)
> 
> The above is correct and mostly accurate. It IS possible to switch out
> your back end fairly easily, though, even with psycopg2; there's a
> standard API that most Python database packages follow. As long as you
> stick to standard SQL (no PostgreSQL extensions) and the standard API
> (no psycopg2 extensions), switching databases is as simple as changing
> your "import psycopg2" into "import cx_oracle" or something. (And,
> most likely, changing your database credentials.)
> 
> The point of an ORM is to make your databasing code look and feel like
> Python code, rather than manually crafting SQL statements everywhere.
> Here's how a simple database operation looks in SQLAlchemy:

Thank you Chris and Chris!

John Black
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: choice of web-framework

2017-10-24 Thread justin walters
On Tue, Oct 24, 2017 at 4:14 AM, Chris Angelico  wrote:

>
> (There are other ORMs than SQLAlchemy, of course; I can't recall the
> exact syntax for Django's off the top of my head, but it's going to be
> broadly similar to this.)
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>


I can help with that:

## Defining a model:

class Thing(models.Model):
"""
This is the "schema" for the `thing` table. The pk field is created
automatically and is called `id` by default. This table with have
four columns: `id`, `foo`, `baz`, and `score`.
"""
foo = models.Charfield(
max_length=140,
blank=False
)
baz = models.CharField(
max_length=140,
blank=True
)
score = models.IntegerField()

## Create an object:

new_thing = Thing.objects.create(foo="bar", baz="foo")

## Get a list of objects:

Thing.objects.all()

## Filter a list of objects:

Thing.objects.filter(foo="bar")

## Modify an object:

thing = Thing.objects.get(id=1)
thing.foo = "baz"
thing.save()

## Perform an aggregation:

data = Thing.objects.aggregate(avg=Avg("score"))
print(data)
>>> {"avg": 50}

## Django basic view(called controllers in other frameworks normally) and
template:

def person_list(request):
"""
Get a collection of `User` objects from the database.
"""
people = User.objects.filter(is_active=True).order_by("date_joined")
return render(
request,
"person/list.html",
context={"people": people}
)


Then, in `templates/person/list.html`:

{% extends 'base.html' %}

{% block content %}

{% for person in people %}

{{person.first_name}} {{person.last_name}}

{% endfor %}

{% endblock %}


Alternatives to Django's ORM and SQLAlchemy include but are not limited to:

- Peewee: https://github.com/coleifer/peewee
- PonyORM: https://ponyorm.com/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-10-24 Thread STINNER Victor

STINNER Victor  added the comment:

What matters when a Python object is allocated? The start of the PyObject 
structure, or the start of the PyGC_Head structure? Would it be possible to 
align the PyObject start?

The simplest option is to store data which needs to be aligned in a second 
memory block allocated by PyMem_AlignedAlloc().

--

___
Python tracker 

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



[issue31862] Port the standard library to PEP 489 multiphase initialization

2017-10-24 Thread Marcel Plch

Change by Marcel Plch :


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

___
Python tracker 

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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-10-24 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
versions:  -Python 2.7, Python 3.3, 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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-10-24 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> My suggestion would be to pass alignof(type) into the allocator via macro.

Do you mean using some new PyMem_ function?  Or as as new tp_ field on the type 
declaration?

--

___
Python tracker 

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



[issue31862] Port the standard library to PEP 489 multiphase initialization

2017-10-24 Thread Petr Viktorin

Petr Viktorin  added the comment:

FWIW, Marcel is an intern in my team, tasked to learn CPython internals by 
trying to improve subinterpreter support. If I don't comment on his issues it's 
because we discussed privately beforehand.

--

___
Python tracker 

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



[issue28936] test_global_err_then_warn in test_syntax is no longer valid

2017-10-24 Thread Guido van Rossum

Guido van Rossum  added the comment:

I think this is very minor but if you two can agree that the code is right I 
think it's a nice little improvement, and I like that that particular test's 
usefulness is restored.


PS. Long-term we should really build error recovery into our antiquated parser 
and report as many errors as we can, without cascading. But that's probably a 
Python 4 project.

--

___
Python tracker 

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



[issue31862] Port the standard library to PEP 489 multiphase initialization

2017-10-24 Thread Marcel Plch

New submission from Marcel Plch :

PEP 489 introduced multiphase initialization of extension and built-in modules.
Now, almost no module in the standard library supports this feature. This 
should be improved to prepare Python for better testing of subinterpreters.

Many benefits of PEP 489 don't apply to stdlib modules. However, the PEP 
effectively says that by using multi-phase init, the module author "promises" 
that the module is "subinterpreter-friendly" [0]. So, when porting, each module 
should be checked that it e.g. doesn't use mutable process-global state.

I'd like to port stdlib to multi-phase init, starting with the easier modules, 
to:
- get familiar with contributing to CPython,
- check and track which modules are already "subinterpreter-friendly", and
- figure out how and where PEP 489 is lacking (beyond what is discussed in 
the PEP itself).


[0]: 
https://www.python.org/dev/peps/pep-0489/#subinterpreters-and-interpreter-reloading

--
components: Extension Modules
messages: 304914
nosy: Dormouse759, encukou, ncoghlan
priority: normal
severity: normal
status: open
title: Port the standard library to PEP 489 multiphase initialization
type: enhancement
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



[issue30817] Abort in PyErr_PrintEx() when no memory

2017-10-24 Thread Xavier de Gaye

Change by Xavier de Gaye :


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



[issue30817] Abort in PyErr_PrintEx() when no memory

2017-10-24 Thread Xavier de Gaye

Xavier de Gaye  added the comment:


New changeset d5d79545b73110b2f4c2b66d150409514e2ca8e0 by xdegaye in branch 
'3.6':
[3.6] bpo-30817: Fix PyErr_PrintEx() when no memory (GH-2526). (#4107)
https://github.com/python/cpython/commit/d5d79545b73110b2f4c2b66d150409514e2ca8e0


--

___
Python tracker 

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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-10-24 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

My suggestion would be to pass alignof(type) into the allocator via macro. Then 
the allocator could at least assert it's providing good enough alignment if not 
provide the correct alignment.

I believe 16-byte alignment is special because it's glibc's malloc's default. 
So "normal" code shouldn't really be expecting anything better than 16-byte 
alignment. Code with higher alignment requirements will have to use APIs like 
the one proposed in #18835.

--

___
Python tracker 

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



[issue31834] BLAKE2: the (pure) SSE2 impl forced on x86_64 is slower than reference

2017-10-24 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

On Tue, Oct 24, 2017, at 00:25, Christian Heimes wrote:
> 
> Christian Heimes  added the comment:
> 
> I'm pretty sure that your PR has disabled all SSE optimizations. AFAIK
> gcc does not enable SSE3 and SSE4 on X86_64 by default.
> 
> $ gcc -dM -E - < /dev/null | grep SSE
> #define __SSE2_MATH__ 1
> #define __SSE_MATH__ 1
> #define __SSE2__ 1
> #define __SSE__ 1

Before this patch, this would cause blake2b.c to use slow SSE2 only
instruction, though, right?

It seems to me this represents an improvement or the status quo in all
cases. With no extra GCC flags, the reference implementation is used
rather than a slow SSE2 implementation. If extra -m flags are in CFLAGS,
the fastest implementation for the target is used.

--

___
Python tracker 

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



[issue31430] [Windows][2.7] Python 2.7 compilation fails on mt.exe crashing with error code C0000005

2017-10-24 Thread Zachary Ware

Change by Zachary Ware :


--
nosy: +db3l

___
Python tracker 

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



[issue30817] Abort in PyErr_PrintEx() when no memory

2017-10-24 Thread Xavier de Gaye

Change by Xavier de Gaye :


--
pull_requests: +4077

___
Python tracker 

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



Re: Compression of random binary data

2017-10-24 Thread Ben Bacarisse
Steve D'Aprano  writes:

> On Tue, 24 Oct 2017 06:46 pm, danceswithnumb...@gmail.com wrote:
>
>> Greg, you're  very smart, but you are missing a big key. I'm not padding,
>> you are still thinking inside the box, and will never solve this by doing
>> so. Yes! At least you see my accomplishment, this will compress any random
>> file.
>
> Talk is cheap.

But highly prized.  Most Usenet cranks only want to be talked to (they
see it as being taken seriously, no matter how rude the respondents are)
so for the cost of something cheap (a little babbling) they get an
endless stream of highly prized attention.

-- 
Ben.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2017-10-24 Thread Ben Bacarisse
Steve D'Aprano  writes:

> On Tue, 24 Oct 2017 09:23 pm, Ben Bacarisse wrote:
>
>> Forget random data.  For one thing it's hard to define, 
>
> That bit is true.
>
>> but more importantly no one cares about it.
>
> But that's wrong.

All generalisations are false.  I was being hyperbolic.

> For instance:
>
> - Encrypted data looks very much like random noise. With more and more data
>   traversing the internet in encrypted form, the ability to compress random
>   noise would be worth billions.
>
> - Compressed data looks somewhat like random noise (with a bit of structure).
>   The more it is compressed, the more random it looks. If you could compress
>   random noise, you could take already compressed data, and compress it again,
>   saving even more space.
>
> - Many multimedia formats (images, sound, video) are compressed using
>   dedicated encoders. The better the encoder, the more it compresses the data
>   (whether lossy or not) the harder it is to compress it further. If you could
>   compress random noise, you could compress JPGs, MP3s, h265-encoded MKVs,
>   etc, saving even more storage and transmission costs.

But these are not random data.  We care about these because they are are
highly structured, non-random data.

> And most importantly:
>
> - Random data is a superset of the arbitrary structured data you mention
>   below. If we could compress random data, then we could compress any data
>   at all, no matter how much or little structure it contained.

Yes, that's part of my point.  Arbitrary data includes random data but
it avoids arguments about what random means.

> This is why the ability to compress random data (if it were possible, which it
> is not) is interesting. Its not because people want to be able to compress
> last night's lottery numbers, or tables of random digits.

The trouble is a pedagogic one.  Saying "you can't compress random data"
inevitably leads (though, again, this is just my experience) to endless
attempts to define random data.  My preferred way out of that is to talk
about algorithmic complexity but for your average "I've got a perfect
compression algorithm" poster, that is step too far.

I think "arbitrary data" (thereby including the results of compression
by said algorithm) is the best way to make progress.


>> Then you publish in a major journal.  Post the link to the journal
>> article when you are done.
>
> These days there are plenty of predatory journals which will be happy to take
> Dancerswithnumber's money in return for publishing it in a junk
> journal.

Sure, but you usually get a huge advantage -- a text to criticise.  Your
average Usenet crank will keep changing what they say to avoid being
pinned down.  Plus you get to note the fact that the journal is junk.

-- 
Ben.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31861] aiter() and anext() built-in functions

2017-10-24 Thread Davide Rizzo

New submission from Davide Rizzo :

PEP 525 suggested that adding aiter() and anext() would need to wait until 
async __aiter__ is dropped in 3.7. Issue 31709 solved that, so now it would be 
possible to add them.

--
components: Library (Lib)
messages: 304910
nosy: davide.rizzo
priority: normal
severity: normal
status: open
title: aiter() and anext() built-in functions
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



[issue31860] IDLE: Make font sample editable

2017-10-24 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue31860] IDLE: Make font sample editable

2017-10-24 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The proposed patch makes the font sample in IDLE font configuration dialog 
editable. This allows users to test fonts with arbitrary samples.

--
assignee: terry.reedy
components: IDLE
messages: 304909
nosy: serhiy.storchaka, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Make font sample editable
type: enhancement
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



[issue31585] Refactor the enumerate.__next__ implementation

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Added a patch for history.

--
Added file: https://bugs.python.org/file47235/enum_next.diff

___
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

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Tal, do you mind to update your patches and create pull requests?

--

___
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

2017-10-24 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
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

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Tail, do you mind to update your patches and create pull requests?

--

___
Python tracker 

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



[issue30639] inspect.getfile(obj) calls object repr on failure

2017-10-24 Thread Yury Selivanov

Yury Selivanov  added the comment:

Thank you, Thomas.

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

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-10-24 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Seems Raymond have changed his mind about using Argument Clinic in itertools 
(msg302908). Tal, do you mind to update your itertools patch and create a pull 
request?

--

___
Python tracker 

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



[issue30639] inspect.getfile(obj) calls object repr on failure

2017-10-24 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset e968bc735794a7123f28f26d68fdf5dc8c845280 by Yury Selivanov 
(Thomas Kluyver) in branch 'master':
bpo-30639: Lazily compute repr for error (#2132)
https://github.com/python/cpython/commit/e968bc735794a7123f28f26d68fdf5dc8c845280


--
nosy: +yselivanov

___
Python tracker 

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



Re: Installing tkinter on FreeBSD

2017-10-24 Thread Stephan Houben
Op 2017-10-23, Thomas Jollans schreef :
> On 24/10/17 00:16, Dick Holmes wrote:
>> I am trying to use tkinter on a FreeBSD system but the installed 
>> versions of Python (2.7 and 3.6) don't have thinter configured. I tried 
>> to download the source (no binaries available for FreeBSD).

What version of FreeBSD is that? 
On 11.1 I get:

$ pkg search tkinter
py27-tkinter-2.7.14_6  Python bindings to the Tk widget set (Python 2.7)
py34-tkinter-3.4.7_6   Python bindings to the Tk widget set (Python 3.4)
py35-tkinter-3.5.4_6   Python bindings to the Tk widget set (Python 3.5)
py36-tkinter-3.6.2_6   Python bindings to the Tk widget set (Python 3.6)
pypy-tkinter-5.8.0 PyPy bindings to the Tk widget set

and for sure installing py36-tkinter-3.6.2_6 works fine.

Stephan
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31859] sharedctypes.RawArray initialization

2017-10-24 Thread Tim

New submission from Tim :

In the initialization of a new `RawArray` the `size_or_initializer` parameter 
is tested for being an instance of `int`. When passing something like 
numpy.int64 here, the code crashes, because it does not recognize this as an 
integer. The workaround is to cast to int(). Wouldn't it be nicer to compare to 
types.IntType to allow for custom integer types?

def RawArray(typecode_or_type, size_or_initializer):
'''
Returns a ctypes array allocated from shared memory
'''
type_ = typecode_to_type.get(typecode_or_type, typecode_or_type)
-if isinstance(size_or_initializer, int):
+if size_or_initializer is IntType:

--
messages: 304902
nosy: meetaig
priority: normal
severity: normal
status: open
title: sharedctypes.RawArray initialization
type: behavior
versions: 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



  1   2   >