[issue31858] IDLE: cleanup use of sys.ps1 and never set it.

2017-10-23 Thread Terry J. Reedy

New submission from Terry J. Reedy :

This issue is about cleaning up IDLE's use of sys.ps1 for its prompt (sys.ps2 
is not used).  A. This will make for cleaner code and fix some bugs.  B. This 
will be better for testing.  (Some possible changes to pyshell might make 
sys.ps1 irrelevant, but that is for the future.)

Part1. editor.EditorWindow.__init__ sets sys.ps1 to '>>> ' if not set.
try:
sys.ps1
except AttributeError:
sys.ps1 = '>>> '
IDLE initially respects a user setting of sys.ps1 in a startup file.

pyshell.PyShell.open_debugger hasand .close_debugger has these lines
sys.ps1 = "[DEBUG ON]\n>>> "
sys.ps1 = ">>> "
These overwrite any user setting of sys.ps1.  As long as IDLE pays attention to 
the initial value of sys.ps1, I consider this a bug.

pyshell.PyShell.show_prompt starts with
try:
s = str(sys.ps1)
except:
s = ""
self.console.write(s)

I suspect that this is a holdover from when IDLE executed user code in its own 
process, as it still does with the deprecated '-n' option.  However, if a -n 
user deletes sys.ps1, the replacement should be '>>> ', not '' (bug 2).

In the current default subprocess mode, users cannot change the IDLE process 
sys module (see #13657), so rereading sys.ps1 for every editor window and 
prompt is nonsensical.

Patch 1: replace the EditorWindow.__init__ code with module level code
sys_ps1 = sys.ps1 if hasattr(sys, 'ps1') else '>>> '
prompt = sys_ps1

Fix pyshell to import editor rather than two of its objects.  In its debugger 
methods, set editor.prompt, using editor.sys_ps1, thus preserving any user 
setting.  In print_prompt, print the current editor.prompt.  (This will disable 
users resetting ps1 in deprecated -n mode, but I consider that okay as it 
matches the normal mode.)

Part 2. The reason the prompt is set in EditorWindow, instead of where is it 
obviously needed, the PyShell subclass of the OutputWindow subclass of 
EditorWindow, is that it is currently used in 
EditorWindow.smart_backspace_event and .newline_and_indent_event, while   
pyshell imports editor (and must), and not the other way around.

Treating the prompt text as special in an editor lead to a bug in 
smart_backspace that was fixed in #13039 by guarding it use with 
self.context_use_ps1.  There is still a nearly inconsequential bug in the 
newline method where the prompt use is not guarded.  (Hitting newline with the 
cursor before the 't' in '>>> test' leaves the preceding space instead of 
deleting it.)

Patch 2: Only the last line of the prompt is relevant in either method.  I 
believe that replacing self.context_use_ps1 = False in an editor, = True in 
Shell with self.last_prompt_line = '' in an editor, = whatever it is in Shell, 
will allow moving sys_ps1 and prompt to pyshell.  This would simplify patch 1.

--
assignee: terry.reedy
components: IDLE
messages: 304860
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE: cleanup use of sys.ps1 and never set it.
type: behavior
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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-23 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Having the ability to allocated aligned memory could help avoid some undefined 
behavior. See #27987 (though, we only need 16-byte alignment there)

--
nosy: +benjamin.peterson

___
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-23 Thread Chris Angelico
On Tue, Oct 24, 2017 at 2:28 AM, Paul Moore  wrote:
> Hope this helps put the subject into context. Compression is a very
> technical subject, to "do it right". Special cases can be worked out,
> sure, but the "hidden assumptions" in a method are what make the
> difference between a "compression algorithm" and a "way of storing my
> particular data more efficiently".

And to put *this* into context and perspective, both of the above are
extremely useful tools/algorithms. Generalized compression algos are
used all the time, special-purpose lossy compression algos too, and
"way[s] of storing my particular data more efficiently" are utterly
crucial to many applications. But they're not universal compression
schemes.

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


[issue31847] Fix commented out tests in test_syntax

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



[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2017-10-23 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
assignee:  -> michael.foord
nosy: +michael.foord

___
Python tracker 

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



[issue27141] Fix collections.UserList shallow copy

2017-10-23 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Either of the patches looks fine.  I lean a bit towards the opt1 patch.

--
assignee: rhettinger -> serhiy.storchaka

___
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-23 Thread Steve D'Aprano
On Tue, 24 Oct 2017 03:13 pm, danceswithnumb...@gmail.com wrote:

> I did that quite a while ago. 352,954 kb.

Sure you did. Let's see the code you used.




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


[issue31841] Several methods of collections.UserString do not return instances of UserString or its subclasses

2017-10-23 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I would support changing format() and format_map().

The join() method has been around for a long time, so changing it might do more 
harm than good.

--
assignee:  -> lisroach
nosy: +lisroach, rhettinger
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



Re: Compression of random binary data

2017-10-23 Thread danceswithnumbers
I did that quite a while ago. 352,954 kb. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compression of random binary data

2017-10-23 Thread Steve D'Aprano
On Tue, 24 Oct 2017 01:27 pm, danceswithnumb...@gmail.com wrote:

> Finally figured out how to turn this into a random binary compression
> program. Since my transform can compress more than dec to binary. Then i
> took a random binary stream, changed it to a decimal stream 0-9 tranformed
> it into a compressed/encrypted binary stream 23.7% smaller. 

Smaller than the original binary stream? I don't think so.

There's nothing clever about "compressing" a random binary stream if first you
expand it, then remove the extra space you added and claim victory because
the result is smaller than the expanded version.


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





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


[issue31856] Unexpected behavior of re module when VERBOSE flag is set

2017-10-23 Thread Bob Kline

Bob Kline  added the comment:

The light finally comes on. I actually *was* putting a backslash into the 
string value, with the raw flag (which is, of course, what you were trying to 
tell me). Thanks for your patience. :-)

--

___
Python tracker 

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



[issue29202] Improve dict iteration

2017-10-23 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

This doesn't meet our criteria for backports.

--
assignee: rhettinger -> serhiy.storchaka
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



Re: Compression of random binary data

2017-10-23 Thread danceswithnumbers
Finally figured out how to turn this into a random binary compression program. 
Since my transform can compress more than dec to binary. Then i took a random 
binary stream, changed it to a decimal stream 0-9 tranformed it into a 
compressed/encrypted binary stream 23.7% smaller. Yes! Decode reverse is 
easy..sorry so excited i could shout. 

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


[issue31857] Make the behavior of USE_STACKCHECK deterministic

2017-10-23 Thread pdox

Change by pdox :


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

___
Python tracker 

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



[issue31857] Make the behavior of USE_STACKCHECK deterministic

2017-10-23 Thread pdox

New submission from pdox :

USE_STACKCHECK is a Windows-only feature which provides additional safety 
against C stack overflow by periodically calling PyOS_CheckStack to determine 
whether the current thread is too close to the end of the stack.

The way USE_STACKCHECK ensures that PyOS_CheckStack is called frequently is 
surprising. It does this by artificially decrementing _Py_CheckRecursionLimit 
with every call to Py_EnterRecursiveCall:

#ifdef USE_STACKCHECK
/* With USE_STACKCHECK, we artificially decrement the recursion limit in 
order
   to trigger regular stack checks in _Py_CheckRecursiveCall(), except if
   the "overflowed" flag is set, in which case we need the true value
   of _Py_CheckRecursionLimit for _Py_MakeEndRecCheck() to function 
properly.
*/
#  define _Py_MakeRecCheck(x)  \
(++(x) > (_Py_CheckRecursionLimit += PyThreadState_GET()->overflowed - 
1))
#else
#  define _Py_MakeRecCheck(x)  (++(x) > _Py_CheckRecursionLimit)
#endif

_Py_CheckRecursionLimit defaults to 1000, and is constant when USE_STACKCHECK 
is off. (except when changed by Py_SetRecursionLimit)

With a single thread, each call to Py_EnterRecursiveCall causes 
_Py_CheckRecursionLimit to decrement by 1 until it equals the current recursion 
depth, at which point _Py_CheckRecursiveCall is triggered, resetting 
_Py_CheckRecursionLimit back to the default. This could be anywhere from 500 to 
1000 calls depending on the recursion depth. With multiple threads, the 
behavior may be more chaotic, as each thread will be decrementing 
_Py_CheckRecursionLimit independently.

I propose that instead, the call to PyOS_CheckStack is triggered in a 
predictable fashion, using a separate counter for each thread, so that it 
occurs every N'th call to Py_EnterRecursiveCall. (N = 64 seems reasonable, as 
PyOS_CheckStack guarantees 2048 * sizeof(void*) bytes remaining on the C stack).

--
components: Windows
messages: 304854
nosy: paul.moore, pdox, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Make the behavior of USE_STACKCHECK deterministic
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue31856] Unexpected behavior of re module when VERBOSE flag is set

2017-10-23 Thread Bob Kline

Bob Kline  added the comment:

I had been under the impression that "escaped" in this context meant that an 
escape character (the backslash) was part of the string value for the regular 
expression (there's a little bit of overloading going on with that word). 
Thanks for setting me straight.

--

___
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-23 Thread Thomas Jollans
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) and build a 
> new version of Python but the build reported that it couldn't install 
> _tkinter. Despite this report, Python works for non-tkinter 
> applications. Is there a magical formula for configuring tkinter during 
> or after a build??

If you have Tcl/Tk installed, the configure script should detect it.

Is Tcl/Tk installed? If yes, does the configure script output say
anything about tcl, tk or tkinter?


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


[issue31856] Unexpected behavior of re module when VERBOSE flag is set

2017-10-23 Thread Matthew Barnett

Matthew Barnett  added the comment:

Your verbose examples put the pattern into raw triple-quoted strings, which is 
OK, but their first character is a backslash, which makes the next character (a 
newline) an escaped literal whitespace character. Escaped whitespace is 
significant in a verbose pattern.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



Re: Sandsifter software finds hidden instructions inside processors.

2017-10-23 Thread skybuck2000
On Tuesday, October 24, 2017 at 1:13:22 AM UTC+2, MRAB wrote:
> On 2017-10-23 23:50, skybuck2...@hotmail.com wrote:
> > Question:
> > 
> > What do the letters
> > 
> > #   v  l  s  c
> > 
> > Stand for in this source code ?
> > 
> > v = not valid/valid
> > l = length
> > s = ?
> > c = ?
> > 
> > If somebody with lots of python experience could dive into this code and 
> > then tell me I'd be most gratefull ! :)
> > 
> > 
> > 
> > #
> > # ./sifter.py --unk --dis --len --sync --tick -- -P1 -t
> > # ./injector -P1 -t -t -R -0 -s 4293486582
> > #
> > # insn tested: 129563
> > # artf found:  0
> > # runtime: 00:00:04.23
> > # seed:4293486582
> > # arch:64
> > # date:2017-10-22 16:10:51
> > #
> > # cpu:
> > # processor : 0
> > # vendor_id : AuthenticAMD
> > # cpu family: 15
> > # model : 43
> > # model name: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
> > # stepping  : 1
> > # microcode : 0x4d
> > #   v  l  s  c
> >  0f0d00  1  3  5  2 
> > (0f0d)
> >  0f0d01  1  3  5  2 
> > (0f0d0100)
> >  0f0d02  1  3  5  2 
> > (0f0d0200)
> >  0f0d03  1  3  5  2 
> > (0f0d0300)
> >0f0d0400  1  4  5  2 
> > (0f0d0400)
> >0f0d0401  1  4  5  2 
> > (0f0d0401)
> >0f0d0402  1  4  5  2 
> > (0f0d0402)
> >0f0d0403  1  4  5  2 
> > (0f0d0403)
> >0f0d0404  1  4  5  2 
> > (0f0d0404)
> >0f0d0405  1  8  5  2 
> > (0f0d0405)
> >0f0d04050100  1  8  5  2 
> > (0f0d04050100)
> >0f0d04050200  1  8  5  2 
> > (0f0d04050200)
> >0f0d04050300  1  8  5  2 
> > (0f0d04050300)
> >0f0d04050400  1  8  5  2 
> > (0f0d04050400)
> > 
> > Bye,
> >Skybuck.
> > 
> 
> v = valid
> l = length
> s = signum
> c = sicode

Thank you, at least signum seems correct, I will investigate sicode later !;)

So far found this tabel describing the meaning for these values:

https://people.cs.pitt.edu/~alanjawi/cs449/code/shell/UnixSignals.htm

Unix Signals
SIGHUP  1   ExitHangup
SIGINT  2   ExitInterrupt
SIGQUIT 3   CoreQuit
SIGILL  4   CoreIllegal Instruction
SIGTRAP 5   CoreTrace/Breakpoint Trap
SIGABRT 6   CoreAbort
SIGEMT  7   CoreEmulation Trap
SIGFPE  8   CoreArithmetic Exception
SIGKILL 9   ExitKilled
SIGBUS  10  CoreBus Error
SIGSEGV 11  CoreSegmentation Fault
SIGSYS  12  CoreBad System Call
SIGPIPE 13  ExitBroken Pipe
SIGALRM 14  ExitAlarm Clock
SIGTERM 15  ExitTerminated
SIGUSR1 16  ExitUser Signal 1
SIGUSR2 17  ExitUser Signal 2
SIGCHLD 18  Ignore  Child Status
SIGPWR  19  Ignore  Power Fail/Restart
SIGWINCH 20 Ignore  Window Size Change
SIGURG  21  Ignore  Urgent Socket Condition
SIGPOLL 22  Ignore  Socket I/O Possible
SIGSTOP 23  StopStopped (signal)
SIGTSTP 24  StopStopped (user)
SIGCONT 25  Ignore  Continued
SIGTTIN 26  StopStopped (tty input)
SIGTTOU 27  StopStopped (tty output)
SIGVTALRM 28ExitVirtual Timer Expired
SIGPROF 29  ExitProfiling Timer Expired
SIGXCPU 30  CoreCPU time limit exceeded
SIGXFSZ 31  CoreFile size limit exceeded
SIGWAITING 32   Ignore  All LWPs blocked
SIGLWP  33  Ignore  Virtual Interprocessor Interrupt for Threads Library
SIGAIO  34  Ignore  Asynch

5 is indeed trap I know that much ! ;)

Bye,
  Skybuck.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue2651] Strings passed to KeyError do not round trip

2017-10-23 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

A new Stackoverflow question gives a better illustration of how special-casing 
KeyError can be a nuisance.
https://stackoverflow.com/questions/46892261/new-line-on-error-message-in-idle-python-3-3/46899120#46899120
>From a current repository build instead of 3.3:

>>> s = 'line\nbreak'
>>> raise Exception(s)
Traceback (most recent call last):
  File "", line 1, in 
Exception: line
break
>>> raise KeyError(s)
Traceback (most recent call last):
  File "", line 1, in 
KeyError: 'line\nbreak'
>

The OP wanted to get the line break to break without fudging the code to catch 
Exception rather than KeyError.  I proposed catching KeyError and then 
'print(err.args[0]' instead of 'print(err)'.

Why this makes a difference, and why KeyError is unique in needing this, is 
obvious after I found this issue and read the code comment quoted by Amaury.  
But it sure wasn't before.

The rational for applying repr only applies when there is exactly one arg of 
value ''.  So I think the fix should be to only apply it when args *is* ('',).  
There is no reason to quote a non-blank message -- and suppress any formatting 
a user supplies.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue31856] Unexpected behavior of re module when VERBOSE flag is set

2017-10-23 Thread Bob Kline

New submission from Bob Kline :

According to the documentation of the re module, "When this flag [re.VERBOSE] 
has been specified, whitespace within the RE string is ignored, except when the 
whitespace is in a character class or preceded by an unescaped backslash; this 
lets you organize and indent the RE more clearly. This flag also lets you put 
comments within a RE that will be ignored by the engine; comments are marked by 
a '#' that’s neither in a character class [n]or preceded by an unescaped 
backslash." (I'm quoting from the 3.6.3 documentation, but I've tested with 
several versions of Python, as indicated in the issue's `Versions` field, all 
with the same results.)

Given this description, I would have expected the output for each of the pairs 
of calls to findall() in the attached repro code to be the same, but that is 
not what's happening. In the case of the first pair of calls, for example, the 
non-verbose version finds two more matches than the verbose version, even 
though the regular expression is identical for the two calls, ignoring 
whitespace and comments in the expression string. Similar problems appear with 
the other two pairs of calls.

Here's the output from the attached code:

['&', '(', '/Term/SemanticType/@cdr:ref', '==']
['/Term/SemanticType/@cdr:ref', '==']
[' XXX ']
[]
[' XXX ']
[]

It would seem that at least one of the following is true:

 1. the module is not behaving as it should
 2. the documentation is wrong
 3. I have not understood the documentation correctly

I'm happy for it to be #3, as long as someone can explain what I have not 
understood.

--
components: Library (Lib), Regular Expressions
files: regex-repro.py
messages: 304849
nosy: bkline, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Unexpected behavior of re module when VERBOSE flag is set
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6
Added file: https://bugs.python.org/file47232/regex-repro.py

___
Python tracker 

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



Re: Sandsifter software finds hidden instructions inside processors.

2017-10-23 Thread skybuck2000
Idea of this software is basically:

Generate random bytes and feed them to processor.

Observe result of processor if good or bad (error codes).

If good check docs.
If bad adjust and retry.

Somebody wrote a nice short explanation of what SandSifter does to give you an 
idea (it's a new algorithm to find undocumented instructions fast !):

It's guessing possible X86 instructions by exploiting the Instruction Decoder 
via the (PF) Page Fault result code. Effectively splitting an instruction 
across two pages and only having one page of it executable. When the decoder 
fetches the instruction it notices that it's incomplete, attempts to fetch the 
next part that is on a new non-executable page. The decoder then throws a page 
fault since it's not executable. So it moves the entire instruction one to the 
left and tries again with various combinations until it doesn't get a page 
fault at which point it executes it.

And thus it attempts to 'tunnel' through every possible instruction. That's the 
general very simplified explanation.

Bye,
  Skybuck.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28936] test_global_err_then_warn in test_syntax is no longer valid

2017-10-23 Thread Guido van Rossum

Guido van Rossum  added the comment:

Am I needed here?

--
nosy:  -Jeremy.Hylton

___
Python tracker 

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



Re: Sandsifter software finds hidden instructions inside processors.

2017-10-23 Thread MRAB

On 2017-10-23 23:50, skybuck2...@hotmail.com wrote:

Question:

What do the letters

#   v  l  s  c

Stand for in this source code ?

v = not valid/valid
l = length
s = ?
c = ?

If somebody with lots of python experience could dive into this code and then 
tell me I'd be most gratefull ! :)



#
# ./sifter.py --unk --dis --len --sync --tick -- -P1 -t
# ./injector -P1 -t -t -R -0 -s 4293486582
#
# insn tested: 129563
# artf found:  0
# runtime: 00:00:04.23
# seed:4293486582
# arch:64
# date:2017-10-22 16:10:51
#
# cpu:
# processor : 0
# vendor_id : AuthenticAMD
# cpu family: 15
# model : 43
# model name: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
# stepping  : 1
# microcode : 0x4d
#   v  l  s  c
 0f0d00  1  3  5  2 (0f0d)
 0f0d01  1  3  5  2 (0f0d0100)
 0f0d02  1  3  5  2 (0f0d0200)
 0f0d03  1  3  5  2 (0f0d0300)
   0f0d0400  1  4  5  2 (0f0d0400)
   0f0d0401  1  4  5  2 (0f0d0401)
   0f0d0402  1  4  5  2 (0f0d0402)
   0f0d0403  1  4  5  2 (0f0d0403)
   0f0d0404  1  4  5  2 (0f0d0404)
   0f0d0405  1  8  5  2 (0f0d0405)
   0f0d04050100  1  8  5  2 (0f0d04050100)
   0f0d04050200  1  8  5  2 (0f0d04050200)
   0f0d04050300  1  8  5  2 (0f0d04050300)
   0f0d04050400  1  8  5  2 (0f0d04050400)

Bye,
   Skybuck.



v = valid
l = length
s = signum
c = sicode
--
https://mail.python.org/mailman/listinfo/python-list


Re: Sandsifter software finds hidden instructions inside processors.

2017-10-23 Thread skybuck2000
Question:

What do the letters

#   v  l  s  c

Stand for in this source code ?

v = not valid/valid
l = length
s = ?
c = ?

If somebody with lots of python experience could dive into this code and then 
tell me I'd be most gratefull ! :)



#
# ./sifter.py --unk --dis --len --sync --tick -- -P1 -t
# ./injector -P1 -t -t -R -0 -s 4293486582
#
# insn tested: 129563
# artf found:  0
# runtime: 00:00:04.23
# seed:4293486582
# arch:64
# date:2017-10-22 16:10:51
#
# cpu:
# processor : 0
# vendor_id : AuthenticAMD
# cpu family: 15
# model : 43
# model name: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
# stepping  : 1
# microcode : 0x4d
#   v  l  s  c
0f0d00  1  3  5  2 (0f0d)
0f0d01  1  3  5  2 (0f0d0100)
0f0d02  1  3  5  2 (0f0d0200)
0f0d03  1  3  5  2 (0f0d0300)
  0f0d0400  1  4  5  2 (0f0d0400)
  0f0d0401  1  4  5  2 (0f0d0401)
  0f0d0402  1  4  5  2 (0f0d0402)
  0f0d0403  1  4  5  2 (0f0d0403)
  0f0d0404  1  4  5  2 (0f0d0404)
  0f0d0405  1  8  5  2 (0f0d0405)
  0f0d04050100  1  8  5  2 (0f0d04050100)
  0f0d04050200  1  8  5  2 (0f0d04050200)
  0f0d04050300  1  8  5  2 (0f0d04050300)
  0f0d04050400  1  8  5  2 (0f0d04050400)

Bye,
  Skybuck.
-- 
https://mail.python.org/mailman/listinfo/python-list


Installing tkinter on FreeBSD

2017-10-23 Thread Dick Holmes
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) and build a 
new version of Python but the build reported that it couldn't install 
_tkinter. Despite this report, Python works for non-tkinter 
applications. Is there a magical formula for configuring tkinter during 
or after a build??

TIA!

--
Dick Holmes

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


[issue31847] Fix commented out tests in test_syntax

2017-10-23 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset d7604f5d0621c23d037455acd682d0d489455d54 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31847: Fix commented out tests in test_syntax. (GH-4084) (#4095)
https://github.com/python/cpython/commit/d7604f5d0621c23d037455acd682d0d489455d54


--

___
Python tracker 

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



Re: grapheme cluster library

2017-10-23 Thread Thomas Jollans
On 23/10/17 16:25, Rustom Mody wrote:
> On Monday, October 23, 2017 at 1:15:35 PM UTC+5:30, Steve D'Aprano wrote:
>>
>> and more. Many linguists also include digraphs (pairs of letters) like the
>> English "th", "sh", "qu", or "gh" as graphemes.
>>
>>
>> https://www.thoughtco.com/what-is-a-grapheme-1690916
>>
>> https://en.wikipedia.org/wiki/Grapheme
> 
> Um… Ok So I am using the wrong word? Your first link says:
> | For example, the word 'ghost' contains five letters and four graphemes 
> | ('gh,' 'o,' 's,' and 't')
> 
> Whereas new regex findall does:
> 
 findall(r'\X', "ghost")
> ['g', 'h', 'o', 's', 't']
 findall(r'\X', "church")
> ['c', 'h', 'u', 'r', 'c', 'h']
> 

The definition of a "grapheme" in the Unicode standard does not
necessarily line up with linguistic definition of grapheme for any
particular language.

Even if we assumed that there was a universally agreed definition of the
term for every written language (for English there certainly isn't),
you'd dictionaries information on which language you're dealing with to
pull this trick off.

As an example to illustrate why you'd need dictionaries:

In Dutch, "ij" (the "long IJ", as opposed to the "greek Y") is generally
considered a single letter, or at the very least a single grapheme.
There is a unicode codepoint for it (ij), but it isn't widely used.

So "vrij" (free) has three graphemes (v r ij) and three or four letters.
However, in "bijectie" (bijection), "i" and "j" are two separate
graphemes, so this word has eight letters and seven or eight graphemes.
("ie" may or may not be one single grapheme...)


-- Thomas


PS: This may not be obvious to you at first unless you're Dutch.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28936] test_global_err_then_warn in test_syntax is no longer valid

2017-10-23 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

OK, I made a PR with the fix and a test that checks the line number for syntax 
error (so that the original purpose test_global_err_then_warn is preserved).

--

___
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-23 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


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

___
Python tracker 

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



[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2017-10-23 Thread Ron Rothman

Ron Rothman  added the comment:

Confirmed that the behavior exists in Python 3.6 as well.

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



[issue31828] Support Py_tss_NEEDS_INIT outside of static initialisation

2017-10-23 Thread Masayuki Yamamoto

Change by Masayuki Yamamoto :


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

___
Python tracker 

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



Re: Windows alternative: multiprocessing.connection.wait on Pipe, Tkinter File Handlers

2017-10-23 Thread Thomas Jollans
On 23/10/17 18:34, Josh Jacobson wrote:
> The two functions in the subject are not fully implementable on Windows,
> and so I am looking for an alternative.
> 
> Relevant SO postings including full code and description, with bounty:
> Freezes
> ,
> Input
> 
> 
> 
> 
> I have two scripts:
> 
> *Processor_child.py*: Its purpose is to perform a number of data analysis
> and cleaning operations. This must perform the same operations when run
> alone (without Tkinter_parent.py) as it does when packaged into a GUI with
> Tkinter_parent.py.
> 
> *Tkinter_parent.py*: Its purpose is to provide a GUI for those who can't
> use Processor_child directly.Within Processor_child, there are for loops
> that ask the user for input on each iteration. These prompts need to appear
> in the Tkinter app, accept the input, and send it back to Processor_child.
> 
> 
> 
> The main issue is having the script not move forward on execution until
> input has been sent.
> 
> I know of three ways to theoretically solve this, but *none of these work
> in production on a Windows machine*:
> 
> 1. while pipe1.poll() != True:
> 
> time.sleep(0.1)

My intuition tells me that this kind of thing should be in a separate
thread rather than buried in the main loop. You might wait in a thread
and somehow (no idea what the best way to do this is in tkinter) pass a
message to the GUI thread when it's done.

Not sure if this will help.

> 
> This causes constant loading and a "freezing" like user experience.
> 
> 2. multiprocessing.connection.wait
> 
> From the documentation: ""Windows: ... Note that pipe handles and socket
> handles are not waitable handles."
> 
> 3. Tkinter file handlers
> 
> From the documentation: "This feature is not available on Windows."

Both of these are about Windows not having the same select() system call
as *nix. You can work around this by using a local (loopback) TCP
connection rather than a multiprocessing-supplied pipe (--> socket
module). Then you can use select on both Windows and *nix (-->select
module).

Why do the GUI and the processing have to be in separate scripts? Maybe
it would be easier to import the processing bits as a module and then
run them "directly" - possibly via multiprocessing or threading.

> 
> 
> *Given that none of the 3 available options works on Windows, what options
> are available for Windows machines?*
> 
> See Tkinter application 'freezes' while continually polling Pipe for
> contents (multiprocessing)
> 
> and How can I implement an `input` method in a Tkinter parent script, with
> the displayed prompt and return value being sent back to a child script?
> 
> for further description and code samples.
> 

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


[issue31847] Fix commented out tests in test_syntax

2017-10-23 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4066

___
Python tracker 

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



[issue31847] Fix commented out tests in test_syntax

2017-10-23 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 3b66ebe7727dba68c2c6ccf0cd85a4c31255b9b4 by Serhiy Storchaka in 
branch 'master':
bpo-31847: Fix commented out tests in test_syntax. (#4084)
https://github.com/python/cpython/commit/3b66ebe7727dba68c2c6ccf0cd85a4c31255b9b4


--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-23 Thread Stefan Krah

Stefan Krah  added the comment:

On Mon, Oct 23, 2017 at 09:16:08PM +, Antoine Pitrou wrote:
> > The Arrow memory format for example recommends 64 bit alignment.
> 
> I presume you mean 64 bytes?

Yes, I was typing too fast.

--

___
Python tracker 

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



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

2017-10-23 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -982

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-23 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

By the way:

> The Arrow memory format for example recommends 64 bit alignment.

I presume you mean 64 bytes?

--

___
Python tracker 

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



[issue27141] Fix collections.UserList shallow copy

2017-10-23 Thread Bar Harel

Bar Harel  added the comment:

Done :-)
Seems like I forgot to edit the news though, I'll try to edit it.

--

___
Python tracker 

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



[issue27141] Fix collections.UserList shallow copy

2017-10-23 Thread Roundup Robot

Change by Roundup Robot :


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



[issue31855] mock_open is not compatible with read(n) (and pickle.load)

2017-10-23 Thread Ron Rothman

New submission from Ron Rothman :

mock.mock_open works as expected when reading the entire file (read()) or when 
reading a single line (readline()), but it seems to not support reading a 
number of bytes (read(n)).

These work as expected:

from mock import mock_open, patch

# works: consume entire "file"
with patch('__main__.open', mock_open(read_data='bibble')) as m:
with open('foo') as h:
result = h.read()

assert result == 'bibble'  # ok

# works: consume one line
with patch('__main__.open', mock_open(read_data='bibble\nbobble')) as m:
with open('foo') as h:
result = h.readline()

assert result == 'bibble\n'  # ok

But trying to read only a few bytes fails--mock_open returns the entire 
read_data instead:

# consume first 3 bytes of the "file"
with patch('__main__.open', mock_open(read_data='bibble')) as m:
with open('foo') as h:
result = h.read(3)

assert result == 'bib', 'result of read: {}'.format(result)  # fails

Output:

Traceback (most recent call last):
  File "/tmp/t.py", line 25, in 
assert result == 'bib', 'result of read: {}'.format(result)
AssertionError: result of read: bibble

The unfortunate effect of this is that mock_open cannot be used with 
pickle.load.

with open('/path/to/file.pkl', 'rb') as f:
x = pickle.load(f)  # this requires f.read(1) to work

--
components: Library (Lib)
messages: 304841
nosy: ron.rothman
priority: normal
severity: normal
status: open
title: mock_open is not compatible with read(n) (and pickle.load)
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue31653] Don't release the GIL if we can acquire a multiprocessing semaphore immediately

2017-10-23 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 828ca59208af0b1b52a328676c5cc0c5e2e999b0 by Victor Stinner in 
branch 'master':
bpo-31653: Remove deadcode in semlock_acquire() (#4091)
https://github.com/python/cpython/commit/828ca59208af0b1b52a328676c5cc0c5e2e999b0


--
nosy: +haypo

___
Python tracker 

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



[issue31854] Add mmap.ACCESS_DEFAULT to namespace

2017-10-23 Thread Roundup Robot

Change by Roundup Robot :


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

___
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-23 Thread Ian Kelly
On Mon, Oct 23, 2017 at 1:42 PM,   wrote:
> Wow, do programmers actually use zscii. That is huge. So much wated space.

Not really. ZSCII is only relevant if you're writing Z-code or a
Z-code interpreter. Those in turn are only relevant if you're writing
Infocom games.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31853] Use super().method instead of socket.method in SSLSocket

2017-10-23 Thread Mads Jensen

Change by Mads Jensen :


--
nosy: +madsjensen -earonesty

___
Python tracker 

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



[issue31854] Add mmap.ACCESS_DEFAULT to namespace

2017-10-23 Thread Justus Schwabedal

New submission from Justus Schwabedal :

I propose to add mmap.ACCESS_DEFAULT into the namespace.  Accessing the default 
value might be necessary, if one needs to overwrite an `ACCESS` keyword 
argument.

--
components: Extension Modules
messages: 304839
nosy: Justus Schwabedal
priority: normal
severity: normal
status: open
title: Add mmap.ACCESS_DEFAULT to namespace
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



[issue31853] Use super().method instead of socket.method in SSLSocket

2017-10-23 Thread Erik Aronesty

New submission from Erik Aronesty :

I asked on #python-dev and was told that it's most likely due to legacy reasons 
that the class has things like `socket.__init__` instead of `super().__init__`

--
assignee: christian.heimes
components: SSL
messages: 304838
nosy: christian.heimes, earonesty
priority: normal
pull_requests: 4063
severity: normal
status: open
title: Use super().method instead of socket.method in SSLSocket
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



Re: choice of web-framework

2017-10-23 Thread Chris Warrick
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.

-- 
Chris Warrick 
PGP: 5EAAEA16
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

There's also aligned calloc, which no native APIs support but is still quite 
useful.

--

___
Python tracker 

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



[issue31800] datetime.strptime: Support for parsing offsets with a colon

2017-10-23 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Note that #5288 relaxed the whole number of minutes restriction on UTC offsets. 
 Since the goal is to be able to parse the output of .isoformat(), I think %z 
should accept sub-minute offsets.

--
nosy: +belopolsky

___
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-23 Thread danceswithnumbers
Wow, do programmers actually use zscii. That is huge. So much wated space.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: choice of web-framework

2017-10-23 Thread John Black
In article , 
ros...@gmail.com says...
> For the database, I generally use PostgreSQL, unless the job's so
> simple it can be done with flat files. Using Flask with SQLAlchemy is
> a popular option, but you can also dive into psycopg2 directly (the
> "2" doesn't mean "Python 2.7 only", it's fine). The tech stack
> Python+Flask+SQLAlchemy+PostgreSQL+Linux is an extremely solid one, or
> you can switch out any part fairly easily.
> 
> Disclaimer: I use Flask and SQLAlchemy when I'm teaching my students
> how to build web apps in Python, but I don't have much experience with
> any other frameworks or ORMs. Other options may very well be viable
> and/or superior; all I can say is that the above *is* viable.

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.

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


Re: Searching For Old Posts On Python

2017-10-23 Thread Cai Gengyang
Right ... I am going to continue learning Python then ...



On Thursday, October 19, 2017 at 3:39:44 AM UTC+8, Ian wrote:
> On Mon, Oct 16, 2017 at 10:42 PM, Cai Gengyang  wrote:
> > https://duckduckgo.com/html/?q=%22Cai%20Gengyang%22%20python  This
> > seems to be the only method that works, using DuckDuckGo
> 
> Or any search engine, really.
> https://www.google.com/search?q=site%3Apython.org+cai+gengyang


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


[issue31852] Crashes with lines of the form "async \"

2017-10-23 Thread Alexandre Hamelin

New submission from Alexandre Hamelin :

Hi.

Python 3.6.2 crashes when interpreting lines with the text "async \" (future 
keyword 'async' and ending with a backslash).

Tested in a docker environment (debian jessie). (see 
github.com/0xquad/docker-python36 if needed)

Examples:

$ docker run -ti --rm python36
root@4c09392f83c8:/# python3.6
Python 3.6.2 (default, Aug  4 2017, 14:35:04)
[GCC 6.4.0 20170724] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> async \
...
  File "", line 1
\ufffd\ufffdF\ufffd\ufffd
 ^
SyntaxError: invalid syntax
>>> async \
Segmentation fault
root@4c09392f83c8:/#



Also,

- file: test.py
#/usr/bin/python3.6
async \

-

$ ./test.py
Segmentation fault
$


Haven't taken the time to produce a backtrace or investigate with latest the 
dev versions or any further.

Let me know if I can assist in any way.

--
components: Interpreter Core
messages: 304835
nosy: Alexandre Hamelin
priority: normal
severity: normal
status: open
title: Crashes with lines of the form "async \"
type: crash
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



Windows alternative: multiprocessing.connection.wait on Pipe, Tkinter File Handlers

2017-10-23 Thread Josh Jacobson
The two functions in the subject are not fully implementable on Windows,
and so I am looking for an alternative.

Relevant SO postings including full code and description, with bounty:
Freezes
,
Input




I have two scripts:

*Processor_child.py*: Its purpose is to perform a number of data analysis
and cleaning operations. This must perform the same operations when run
alone (without Tkinter_parent.py) as it does when packaged into a GUI with
Tkinter_parent.py.

*Tkinter_parent.py*: Its purpose is to provide a GUI for those who can't
use Processor_child directly.Within Processor_child, there are for loops
that ask the user for input on each iteration. These prompts need to appear
in the Tkinter app, accept the input, and send it back to Processor_child.



The main issue is having the script not move forward on execution until
input has been sent.

I know of three ways to theoretically solve this, but *none of these work
in production on a Windows machine*:

1. while pipe1.poll() != True:

time.sleep(0.1)

This causes constant loading and a "freezing" like user experience.

2. multiprocessing.connection.wait

>From the documentation: ""Windows: ... Note that pipe handles and socket
handles are not waitable handles."

3. Tkinter file handlers

>From the documentation: "This feature is not available on Windows."


*Given that none of the 3 available options works on Windows, what options
are available for Windows machines?*

See Tkinter application 'freezes' while continually polling Pipe for
contents (multiprocessing)

and How can I implement an `input` method in a Tkinter parent script, with
the displayed prompt and return value being sent back to a child script?

for further description and code samples.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-23 Thread Stefan Krah

Stefan Krah  added the comment:

On Mon, Oct 23, 2017 at 05:16:53PM +, STINNER Victor wrote:
> Memory allocated by PyMem_AlignedAlloc() must be freed with 
> PyMem_AlignedFree().
> 
> We cannot reuse PyMem_Free(). On Windows, PyMem_AlignedAlloc() is implemented 
> with _aligned_malloc() which requires to release the memory with 
> _aligned_free().

Ah, too bad. Of course Windows does something different again. This weakens
my use case somewhat, but I guess it would still be nice to have the functions
(if you think it's maintainable).

--

___
Python tracker 

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



[issue31822] Document that urllib.parse.{Defrag, Split, Parse}Result are namedtuples

2017-10-23 Thread Éric Araujo

Éric Araujo  added the comment:

I suggest using :term:`named tuple` for the link (+ an example of using 
_replace as Mike said)

--

___
Python tracker 

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



[issue31822] Document that urllib.parse.{Defrag, Split, Parse}Result are namedtuples

2017-10-23 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

collections.namedtuples is not a class.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31822] Document that urllib.parse.{Defrag, Split, Parse}Result are namedtuples

2017-10-23 Thread Éric Araujo

Change by Éric Araujo :


--
keywords: +easy
nosy: +eric.araujo
stage:  -> needs patch
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



[issue25041] document AF_PACKET socket address format

2017-10-23 Thread Cheryl Sabella

Change by Cheryl Sabella :


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



[issue31851] test_subprocess hangs randomly on x86 Windows7 3.x

2017-10-23 Thread STINNER Victor

New submission from STINNER Victor :

test_subprocess hanged on the build 46 of x86 Windows7 3.x:

http://buildbot.python.org/all/#/builders/58/builds/46

(...)
1:29:55 [405/407] test_cmath passed -- running: test_subprocess (1249 sec)
1:29:58 [406/407] test_pstats passed -- running: test_subprocess (1252 sec)

The buildbot is slow which might have caused a timing issue.

--
components: Tests
keywords: buildbot
messages: 304831
nosy: haypo
priority: normal
severity: normal
status: open
title: test_subprocess hangs randomly on x86 Windows7 3.x
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



[issue31850] test_nntplib failed with "nntplib.NNTPDataError: line too long"

2017-10-23 Thread STINNER Victor

STINNER Victor  added the comment:

It also failed on Travis CI:

https://mail.python.org/pipermail/python-committers/2017-October/004910.html

Other buildbot failures:

http://buildbot.python.org/all/#builders/80/builds/17
http://buildbot.python.org/all/#/builders/3/builds/48
http://buildbot.python.org/all/#/builders/47/builds/51
http://buildbot.python.org/all/#/builders/99/builds/50
http://buildbot.python.org/all/#/builders/103/builds/50
http://buildbot.python.org/all/#/builders/88/builds/51
http://buildbot.python.org/all/#builders/85/builds/51
http://buildbot.python.org/all/#/builders/53/builds/52
http://buildbot.python.org/all/#/builders/12/builds/49
http://buildbot.python.org/all/#/builders/106/builds/51
http://buildbot.python.org/all/#/builders/13/builds/51
http://buildbot.python.org/all/#/builders/27/builds/50
http://buildbot.python.org/all/#/builders/16/builds/51
http://buildbot.python.org/all/#/builders/87/builds/50
http://buildbot.python.org/all/#/builders/90/builds/28
http://buildbot.python.org/all/#/builders/30/builds/47
http://buildbot.python.org/all/#/builders/32/builds/47

--

___
Python tracker 

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



[issue29438] use after free in key sharing dict

2017-10-23 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -960

___
Python tracker 

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



[issue31850] test_nntplib failed with "nntplib.NNTPDataError: line too long"

2017-10-23 Thread STINNER Victor

New submission from STINNER Victor :

test_nntplib failed on many buildbots yesterday with the "line too long" error. 
It may be related to bpo-28971.

Example:

http://buildbot.python.org/all/#/builders/12/builds/52

(...)
test_with_statement (test.test_nntplib.NetworkedNNTP_SSLTests) ... ok
test_xhdr (test.test_nntplib.NetworkedNNTP_SSLTests) ... ok
test_xover (test.test_nntplib.NetworkedNNTP_SSLTests) ... ERROR
test_zlogin (test.test_nntplib.NetworkedNNTP_SSLTests) ... ok
test_zzquit (test.test_nntplib.NetworkedNNTP_SSLTests) ... ok
test_module_all_attribute (test.test_nntplib.PublicAPITests) ... ok
test test_nntplib failed
test_we_are_in_reader_mode_after_connect 
(test.test_nntplib.SendReaderNNTPv2Tests) ... ok

==
ERROR: test_xover (test.test_nntplib.NetworkedNNTP_SSLTests)
--
Traceback (most recent call last):
  File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_nntplib.py", 
line 241, in wrapped
meth(self)
  File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_nntplib.py", 
line 125, in test_xover
resp, lines = self.server.xover(last - 5, last)
  File "D:\buildarea\3.x.ware-win81-release\build\lib\nntplib.py", line 804, in 
xover
file)
  File "D:\buildarea\3.x.ware-win81-release\build\lib\nntplib.py", line 525, in 
_longcmdstring
resp, list = self._getlongresp(file)
  File "D:\buildarea\3.x.ware-win81-release\build\lib\nntplib.py", line 494, in 
_getlongresp
line = self._getline()
  File "D:\buildarea\3.x.ware-win81-release\build\lib\nntplib.py", line 434, in 
_getline
raise NNTPDataError('line too long')
nntplib.NNTPDataError: line too long

--
components: Tests
keywords: buildbot
messages: 304829
nosy: haypo
priority: normal
severity: normal
status: open
title: test_nntplib failed with "nntplib.NNTPDataError: line too long"
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



Re: Compression of random binary data

2017-10-23 Thread Neil Cerutti
On 2017-10-23, alister via Python-list  wrote:
>> 12344321
>>
>> It only takes seven 8 bit bytes to represent this
>
> Would you care to provide the seven 8-bit bytes you propose to use?
> Paul

 I would suspect he is using BCD & storing 2 values in reach
 byte that is not what is meant by you cant compress random
 data. his compression is simply removing redundant space
 from an inefficient coding
>>>
>>> I suspect he is using ASCII and storing one value in each byte.
>> 
>> There's also ZSCII, which stores roughly 3 characters every 2
>> bytes. Since all the digits are in A2, this sequence would
>> take up 7 bytes in ZSCII as well.
>> 
>> http://inform-fiction.org/zmachine/standards/z1point0/sect03.html
>
> not sure how 16 characters can be represented by either ascii
> or zscii in only 8 bytes

Oops! I hastily counted completely wrong. It's 10 bytes in ZSCII
version 2, using a shift-lock.

   * 16 bits* 
12 ->  0 00101 01001 01010
349 -> 0 01011 01100 10001
999 -> 0 10001 10001 10001
888 -> 0 1 1 1
843 -> 0 1 01100 01011
21  -> 1 01010 01001 00101

-- 
Neil Cerutti

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


[issue30722] Tools/demo/redemo.py broken

2017-10-23 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you, Christoph. I wasn't aware of Tools/demo/redemo.py and I must say it 
was fun to play with while reviewing PR 2311.

--
components: +Demos and Tools -Regular Expressions
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



[issue30722] Tools/demo/redemo.py broken

2017-10-23 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset a5f9d24c171c7e3a3715161fd16b747c7dcaf76f by Berker Peksag (Miss 
Islington (bot)) in branch '3.6':
bpo-30722: Make redemo work with Python 3.6+ (GH-2311)
https://github.com/python/cpython/commit/a5f9d24c171c7e3a3715161fd16b747c7dcaf76f


--

___
Python tracker 

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



[issue31653] Don't release the GIL if we can acquire a multiprocessing semaphore immediately

2017-10-23 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4061

___
Python tracker 

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



Re: I used list, def. why li += [100,200] , and li = li + [100,200] is different

2017-10-23 Thread Bill

Rob Gaddi wrote:

On 10/23/2017 09:29 AM, 임현준 wrote:

I am a Korean student, and I am a beginner in English and Python.;(

I can't understand about this def

If I want to print

[1,2,3,4,5]
[1,2,3,4,5,100,200]

I will make code like this, and I can understand code.


def modify(li):
  li += [100,200]

list = [1,2,3,4,5]
print(list)
modify(list)
print(list)


BUT, when I make code like this.

I will make code like this, and I can understand code.


def modify(li):
  li = li + [100,200]

list = [1,2,3,4,5]
print(list)
modify(list)
print(list)



python print

[1,2,3,4,5]
[1,2,3,4,5]

why 'li+= [100,200]'and 'li = li + [100,200]' 's print is different
please help me



Lists are mutable, they can be changed.  Your call to += is equivalent 
to a call to li.extend([100, 200]), which changes the single existing 
object pointed to by the "li" reference.  The second time, however, 
you take the existing value that "li" refers to [1,2,3,4,5], create a 
new object that is ([1,2,3,4,5] + [100,200]), and reassign the local 
reference "li" to point to that new object.  Then your function ends, 
"li" goes out of scope, nothing points to that newly created object 
and it gets lost.





The problem and both solutions are great!  Thanks for posting!

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


Re: I used list, def. why li += [100, 200] , and li = li + [100, 200] is different

2017-10-23 Thread Rhodri James

On 23/10/17 17:29, 임현준 wrote:

I am a Korean student, and I am a beginner in English and Python.;(

I can't understand about this def

If I want to print

[1,2,3,4,5]
[1,2,3,4,5,100,200]

I will make code like this, and I can understand code.


def modify(li):
  li += [100,200]
> list = [1,2,3,4,5]
print(list)
modify(list)
print(list) 


Here is approximately what Python does when you run this:

* Create a list [1,2,3,4,5]

* Give the list the name "list".  In talking about Python we often say 
that it *binds* the name "list" to the list [1,2,3,4,5].  (It is usually 
a bad idea to use names like "list" that also have a meaning in Python, 
but we will ignore that for now.)



list \
  +---+
  | 1,2,3,4,5 |
  +---+

* Print the object bound to the name "list", which is the list [1,2,3,4,5].

* Call modify().  This also binds the name "li" to the object that 
"list" is bound to.



list \
  +---+
  | 1,2,3,4,5 |
  +---+
li --/

* Create a new list [100,200]

* "li += [100,200]" for a list means "change the list bound to the name 
'li' by joining the new list onto the end of it.  It is still the same 
object, it just has some more added to it.


list \
  +---+
  | 1,2,3,4,5,100,200 |
  +---+
li --/

"list" is still bound to the same object, so you see the changes outside 
the function modify().




BUT, when I make code like this.

I will make code like this, and I can understand code.


def modify(li):
  li = li + [100,200]


What happens here is a little different.  It starts off the same with 
"li" and "list" bound to the same object:


list \
  +---+
  | 1,2,3,4,5 |
  +---+
li --/

and a new object [100,200] that doesn't have a name.  What happens next is:

* Take the object bound to the name "li" and the unnamed object 
[100,200], and create a *new* object by joining them together.


* Bind the name "li" to this new object

list \
  +---+
  | 1,2,3,4,5 |
  +---+

li --\
  +---+
  | 1,2,3,4,5,100,200 |
  +---+

Notice that it is only the name "li" that is bound.  The name "list" 
still refers to the original object.  When we return from the function, 
we stop using the name "li" and nothing refers to our new object 
[1,2,3,4,5,100,200] any more.  Python will quietly delete it ("garbage 
collect") in the background.


The key is that "+" on its own creates a new object, while "+=" alters 
the existing object.


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


[issue29368] Optimize unpickling list-like objects: use extend() instead of append()

2017-10-23 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -836

___
Python tracker 

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



[issue29084] C API of OrderedDict

2017-10-23 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
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-23 Thread danceswithnumbers
Good point

I hope it has a use, other than a cute toyi don't see it yet.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-23 Thread STINNER Victor

STINNER Victor  added the comment:

I added _PyTraceMalloc_Track() and _PyTraceMalloc_Untrack() private functions 
to the C API in Python 3.6. These functions were made public in Python 3.7: 
renamed to PyTraceMalloc_Track() and PyTraceMalloc_Untrack(). I made this 
change to allow numpy to trace memory allocations, to debug memory leaks.

numpy cannot use Python memory allocators because numpy requires aligned memory 
blocks which are required to use CPU SIMD instructions.


Stefan Krah:
> I think many people would welcome this in scientific computing: The Arrow 
> memory format for example recommends 64 bit alignment.

Ah, that's an interesting use case.

I created attached PR 4089 to implement PyMem_AlignedAlloc():

   void* PyMem_AlignedAlloc(size_t alignment, size_t size);
   void PyMem_AlignedFree(void *ptr);

Memory allocated by PyMem_AlignedAlloc() must be freed with PyMem_AlignedFree().

We cannot reuse PyMem_Free(). On Windows, PyMem_AlignedAlloc() is implemented 
with _aligned_malloc() which requires to release the memory with 
_aligned_free().


Raymond Hettinger:
>> Adding yet another API to allocate memory has a cost
> Please don't FUD this one to death.

Statistics (size) on my PR:

 Doc/c-api/memory.rst  |  43 +-
 Doc/whatsnew/3.7.rst  |   4 +
 Include/internal/mem.h|   6 +-
 Include/objimpl.h |   2 +
 Include/pymem.h   |  16 +-
 .../2017-10-23-19-03-38.bpo-18835.8XEjtG.rst  |   9 +
 Modules/_testcapimodule.c |  83 ++-
 Modules/_tracemalloc.c| 131 +++-
 Objects/obmalloc.c| 616 +--
 9 files changed, 655 insertions(+), 255 deletions(-)

That's quite a big change "just to add PyMem_AlignedAlloc()" :-)

--

___
Python tracker 

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



[issue30722] Tools/demo/redemo.py broken

2017-10-23 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue30722] Tools/demo/redemo.py broken

2017-10-23 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 62adc55aff0b78447568f73bd1abc610d2784bf8 by Berker Peksag 
(Christoph Sarnowski) in branch 'master':
bpo-30722: Make redemo work with Python 3.6+ (GH-2311)
https://github.com/python/cpython/commit/62adc55aff0b78447568f73bd1abc610d2784bf8


--
nosy: +berker.peksag

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-23 Thread STINNER Victor

Change by STINNER Victor :


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



[issue29202] Improve dict iteration

2017-10-23 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Do you mind to create a pull request Raymond?

--

___
Python tracker 

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



[issue31826] Misleading __version__ attribute of modules in standard library

2017-10-23 Thread Éric Araujo

Éric Araujo  added the comment:

The version in distutils is derived from sys.version and should be left as is 
too.  Thanks!

--
nosy: +eric.araujo

___
Python tracker 

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



[issue30549] ProcessPoolExecutor hangs forever if the object raises on __getstate__

2017-10-23 Thread Berker Peksag

Change by Berker Peksag :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Deadlocks in `concurrent.futures.ProcessPoolExecutor`

___
Python tracker 

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



Re: I used list, def. why li += [100, 200] , and li = li + [100, 200] is different

2017-10-23 Thread MRAB

On 2017-10-23 17:29, 임현준 wrote:

I am a Korean student, and I am a beginner in English and Python.;(

I can't understand about this def

If I want to print

[1,2,3,4,5]
[1,2,3,4,5,100,200]

I will make code like this, and I can understand code.


def modify(li):
  li += [100,200]

list = [1,2,3,4,5]
print(list)
modify(list)
print(list)


BUT, when I make code like this.

I will make code like this, and I can understand code.


def modify(li):
  li = li + [100,200]

list = [1,2,3,4,5]
print(list)
modify(list)
print(list)



python print

[1,2,3,4,5]
[1,2,3,4,5]

why 'li+= [100,200]'and 'li = li + [100,200]' 's print is different
please help me


In both cases, you're binding a list to the local name "li".

However, in the first example:

li += [100,200]

it's doing this:

li = li.__iadd__([100,200])

The __iadd__ method is modifying the list li and then returning that 
modified list.


The list that was passed in has been modified.

In the second example:

li = li + [100,200]

it's doing this:

li = li.__add__([100,200])

The __add__ method is creating a new list and then returning that new list.

The local name "li" now refers to a new list, not the list that was 
passed in. When the function returns, the local name "li" is forgotten, 
and the new list that "li" referred to is discarded because there are no 
other references to it.

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


[issue31752] Assertion failure in timedelta() in case of bad __divmod__

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



[issue31752] Assertion failure in timedelta() in case of bad __divmod__

2017-10-23 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 5ef883b096895a84123760859f0f34ad37bf2277 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-31752: Fix possible crash in timedelta constructor called with custom 
integers. (GH-3947) (#4088)
https://github.com/python/cpython/commit/5ef883b096895a84123760859f0f34ad37bf2277


--

___
Python tracker 

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



[issue23699] Add a macro to ease writing rich comparisons

2017-10-23 Thread Charalampos Stratakis

Charalampos Stratakis  added the comment:

PR has been rebased on top of master and also blurbified.

--

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

Change by Serhiy Storchaka :


--
nosy: +ncoghlan

___
Python tracker 

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



Re: I used list, def. why li += [100,200] , and li = li + [100,200] is different

2017-10-23 Thread Rob Gaddi

On 10/23/2017 09:29 AM, 임현준 wrote:

I am a Korean student, and I am a beginner in English and Python.;(

I can't understand about this def

If I want to print

[1,2,3,4,5]
[1,2,3,4,5,100,200]

I will make code like this, and I can understand code.


def modify(li):
  li += [100,200]

list = [1,2,3,4,5]
print(list)
modify(list)
print(list)


BUT, when I make code like this.

I will make code like this, and I can understand code.


def modify(li):
  li = li + [100,200]

list = [1,2,3,4,5]
print(list)
modify(list)
print(list)



python print

[1,2,3,4,5]
[1,2,3,4,5]

why 'li+= [100,200]'and 'li = li + [100,200]' 's print is different
please help me



Lists are mutable, they can be changed.  Your call to += is equivalent 
to a call to li.extend([100, 200]), which changes the single existing 
object pointed to by the "li" reference.  The second time, however, you 
take the existing value that "li" refers to [1,2,3,4,5], create a new 
object that is ([1,2,3,4,5] + [100,200]), and reassign the local 
reference "li" to point to that new object.  Then your function ends, 
"li" goes out of scope, nothing points to that newly created object and 
it gets lost.


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


Re: Compression of random binary data

2017-10-23 Thread Thomas Jollans
On 2017-10-23 17:39, danceswithnumb...@gmail.com wrote:
> Thanks Paul...blunt to the point.
> 
> My 8 year old can decode this back into base 10, i still have to help him a 
> bit going from base 10 to 8 bit bytesit's incredibly simple to decode. No 
> dictionary, can easily be done with pencil and paper, does not rely on 
> redundancies.

It is, is it? Well, you know the rules:

"Code or it didn't happen."


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


I used list, def. why li += [100, 200] , and li = li + [100, 200] is different

2017-10-23 Thread 임현준
I am a Korean student, and I am a beginner in English and Python.;(

I can't understand about this def

If I want to print 

[1,2,3,4,5]
[1,2,3,4,5,100,200]

I will make code like this, and I can understand code.


def modify(li):
 li += [100,200]

list = [1,2,3,4,5]
print(list)
modify(list)
print(list)


BUT, when I make code like this.

I will make code like this, and I can understand code.


def modify(li):
 li = li + [100,200]

list = [1,2,3,4,5]
print(list)
modify(list)
print(list)



python print

[1,2,3,4,5]
[1,2,3,4,5]

why 'li+= [100,200]'and 'li = li + [100,200]' 's print is different
please help me
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28645] Drop __aiter__ compatibility layer from 3.7

2017-10-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

Already resolved as part of https://bugs.python.org/issue31709. Closing this 
one.

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> Drop support for asynchronous __aiter__

___
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-23 Thread Thomas Jollans
On 2017-10-23 07:39, Steve D'Aprano wrote:
> By the way: here is a very clever trick for hiding information in the file
> system:
> 
> http://www.patrickcraig.co.uk/other/compression.php
> 
> 
> but as people point out, the information in the file, plus the information in
> the file system, ends up being *larger* than the original. Well done to
> Patrick Craig for finding a clever loophole to "win" the challenge, but he
> did so without actually compressing the original data.

Thanks Steve that was very entertaining.


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


[issue31845] PYTHONDONTWRITEBYTECODE and PYTHONOPTIMIZE have no effect

2017-10-23 Thread Stefan Krah

Change by Stefan Krah :


--
nosy: +eric.snow

___
Python tracker 

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



[issue31833] Compile fail on gentoo for MIPS CPU of loongson 2f

2017-10-23 Thread emtone

emtone  added the comment:

OK, Thank you pitrou!

--

___
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-23 Thread Xavier de Gaye

Xavier de Gaye  added the comment:


New changeset 66caacf2f0d6213b049a3097556e28e30440b900 by xdegaye in branch 
'master':
bpo-30817: Fix PyErr_PrintEx() when no memory (#2526)
https://github.com/python/cpython/commit/66caacf2f0d6213b049a3097556e28e30440b900


--

___
Python tracker 

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



[issue5430] imaplib: must not replace LF or CR by CRLF in literals

2017-10-23 Thread Matej Cepl

Change by Matej Cepl :


--
nosy: +mcepl

___
Python tracker 

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



[issue31849] Python/pyhash.c warning: comparison of integers of different signs

2017-10-23 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +easy (C)
stage:  -> needs patch

___
Python tracker 

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



[issue31849] Python/pyhash.c warning: comparison of integers of different signs

2017-10-23 Thread Xavier de Gaye

New submission from Xavier de Gaye :

When built with: Android clang version 3.8.275480  (based on LLVM 3.8.275480)

The following warning is emitted:

ccache 
/pathto/android/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang 
-target x86_64-none-linux-androideabi -gcc-toolchain 
/pathto/android/android-ndk/toolchains/x86_64-4.9/prebuilt/linux-x86_64 -c 
-Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 
-Wall -Wstrict-prototypes --sysroot=/pathto/android/android-ndk/sysroot 
-D__ANDROID_API__=21 -isystem 
/pathto/android/android-ndk/sysroot/usr/include/x86_64-linux-android 
-Wno-unused-value -Wno-empty-body -Qunused-arguments 
-Wno-nullability-completeness -Wno-parentheses-equality   -std=c99 -Wextra 
-Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers 
-Werror=implicit-function-declaration  -IObjects -IInclude -IPython -I. 
-I/pathto/src/python/master/Include 
-I/pathto/tmp/android-makesetup/build/python3.7-extlibs-android-21-x86_64//data/local/tmp/python/include
 --sysroot=/pathto/android/android-ndk/sysroot -D__ANDROID_API__=21 -isystem 
/pathto/android/android-ndk/sysroot/usr/include/x
 86_64-linux-android   -DPy_BUILD_CORE -o Python/pyhash.o 
/pathto/src/python/master/Python/pyhash.c
/pathto/src/python/master/Python/pyhash.c:275:11: warning: comparison of 
integers of different signs: 'Py_uhash_t' (aka 'unsigned long') and 'int' 
[-Wsign-compare]
if (x == -1) {
~ ^  ~~
1 warning generated.

--
components: Interpreter Core
messages: 304816
nosy: christian.heimes, xdegaye
priority: normal
severity: normal
status: open
title: Python/pyhash.c warning: comparison of integers of different signs
type: compile error
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



[issue28936] test_global_err_then_warn in test_syntax is no longer valid

2017-10-23 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Do you mind to create a pull request Ivan?

--

___
Python tracker 

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



[issue31833] Compile fail on gentoo for MIPS CPU of loongson 2f

2017-10-23 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

If it works with 2.7.14 then we can just close this issue.

--
resolution:  -> out of date
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



[issue31833] Compile fail on gentoo for MIPS CPU of loongson 2f

2017-10-23 Thread emtone

emtone  added the comment:

I update the Python to 2.7.14 and It's Compile success.

Here is running the command with strace:
yeeloong /home/gentoo # python --version
Python 2.7.14
yeeloong /home/gentoo # strace -o ./python_strace.txt python -c "import
_multiprocessing"

--
Added file: https://bugs.python.org/file47231/python_strace.txt

___
Python tracker 

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



[issue28645] Drop __aiter__ compatibility layer from 3.7

2017-10-23 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Do you mind to create a pull request Yury?

--

___
Python tracker 

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



  1   2   >