[issue23883] __all__ lists are incomplete

2016-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks for caring for this Martin.

> Should we add anything into What's New, maybe warning of new symbols from 
> "import *"?

I think yes.

--

___
Python tracker 

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



Re: Using 'Or'

2016-01-16 Thread Marko Rauhamaa
Christian Gollwitzer :

> Am 15.01.16 um 21:24 schrieb Kitten Corner:
>> print('i like pie' or 'i like donuts')
>
>> it only does the thing that's before the 'or', please help!
>
> I think you misunderstand what "or" does. It evaluates the first
> expression, and if this is false, it evaluates the second.

The fact that "or" doesn't return True but one of its arguments is a
great feature. Too bad "any" doesn't follow suit:

   >>> any(x for x in ('a', 'b'))
   True

 import random
 random.choice(('donuts','apples'))
> 'donuts'

Well, there's that. "Any" works more nicely with generators, though.


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


Re: Using 'Or'

2016-01-16 Thread Chris Angelico
On Sat, Jan 16, 2016 at 7:24 AM, Kitten Corner  wrote:
> Hi, I have python version 3.5.1 and I am working on a project, I'm trying
> to make it by using the 'or' sequence, I'm trying to make it do 1 thing or
> the other, here's an example: print('i like pie' or 'i like donuts'), it
> only does the thing that's before the 'or', please help!

Under what circumstances do you want it to take the other? So far,
Python is correctly printing out one or the other of them.

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


getkey

2016-01-16 Thread Ulli Horlacher
I have an application which runs on Windows and UNIX where I need to get
one keypress from the user (without ENTER). 
Keys which sends escape sequences (e.g. cursor or function keys) should be
ignored. 

I have a solution for Windows, but not for UNIX:
The first byte of an escape sequence (example: ^[[21~ for F10) is
recognized, but the trailing bytes then are not discarded by
clear_keyboard_buffer() and get_key() returns the second byte of the
escape sequence.

My code:

try:
  import msvcrt
except ImportError:
  import tty
  import select
  import termios


def get_key():
  try:
k = msvcrt.getch()
  except:
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
  tty.setraw(fd)
  k = sys.stdin.read(1)
finally:
  termios.tcsetattr(fd,termios.TCSADRAIN,old_settings)

  if k == '\033': 
clear_keyboard_buffer()
return get_key()
  else:
return k


def clear_keyboard_buffer():
  try:
while msvcrt.kbhit(): msvcrt.getwch()
  except:
fd = sys.stdin.fileno()
while len(select.select([fd],[],[],0.0)[0]) > 0: os.read(fd,1)
termios.tcflush(sys.stdin,termios.TCIOFLUSH)


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a limit to the characters used in a print statement?

2016-01-16 Thread Mark Lawrence

On 16/01/2016 13:49, Robert James Liguori wrote:

I'm doing a data conversion and all is garbled when I add an extra hundred 
lines to the print in my for loop.  Is there a limit?



This will probably get answered under the thread with subject "print 
size limit" that arrived one minute before this did.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


[issue13743] xml.dom.minidom.Document class is not documented

2016-01-16 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



Using 'Or'

2016-01-16 Thread Kitten Corner
Hi, I have python version 3.5.1 and I am working on a project, I'm trying
to make it by using the 'or' sequence, I'm trying to make it do 1 thing or
the other, here's an example: print('i like pie' or 'i like donuts'), it
only does the thing that's before the 'or', please help!

From,
Kitten Corner
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue22995] Restrict default pickleability

2016-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Nice.

Did you considered the possibility to implement the pickling compatible with 
non-accelerated Python classes with __dict__ for every Cython class? I.e. 
__getstate__ that returns a dict that maps field names to values and 
__setstate__ that unpacks such dict?

--

___
Python tracker 

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



Re: print size limit

2016-01-16 Thread Chris Angelico
On Sun, Jan 17, 2016 at 12:48 AM,   wrote:
> I'm doing a format conversion and all works fine until I add another 100 
> characters... haven't determined exactly where the breaking point is... but 
> the initial conversion gets truncated and then fixes itself a little while 
> in.  Is there a limit on the print statement or the print statement nested in 
> a for loop?
> --

Shouldn't be. Can you post your code?

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


[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Win 10, 2.7.11, from IDLE editor: 1.py take several seconds, nothing printed.  
Add 'print' in front of call and 
Traceback (most recent call last):
  File "F:\Python\mypy\tem.py", line 3, in 
print strop.replace("\x100"*0xEAAA,"\x100","AA"*0x)
  File "C:\Programs\Python27\lib\idlelib\PyShell.py", line 1356, in write
return self.shell.write(s, self.tags)
MemoryError

strop gone in 3.5.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue26077] Make slicing of immutable structures return a view instead of a copy

2016-01-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Proposals for strings views have be rejected precisely because of the 
keep-alive effect.

I do not remember if tuples were explicitly part of earlier discussions. One 
could make the argument that million-item tuples, and especially slicing 
thereof is rarer than the same for strings.  On the other hand, copying short 
slices of short to medium tuples is not a big deal.

Because of previous discussions, I think this issue should be either closed or 
suspended for python-ideas discussion.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Are you sure that you use 2.7.11 Ramin?

Can anyone else confirm the issue?

--
status: open -> pending

___
Python tracker 

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



[issue22995] Restrict default pickleability

2016-01-16 Thread Stefan Behnel

Stefan Behnel added the comment:

For reference, the bug in Cython is fixed here:

https://github.com/cython/cython/commit/ececb3e9473f6aaa65f29467921594c316ec2f06

--

___
Python tracker 

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



Re: Python plugin (semantic-aware) for the Qt Creator IDE

2016-01-16 Thread Leandro T. C. Melo
Hi again...

Sorry, but I have a new url for the video (it's just slightly modified).

https://youtu.be/71aqIwv3vJs

Thanks,
Leandro


On Thursday, January 14, 2016 at 9:23:47 AM UTC-2, Leandro T. C. Melo wrote:
> Hi everyone,
> 
> I've recently published a Python (and other languages) plugin for the Qt 
> Creator IDE. In fact, Qt Creator already has some official Python support, 
> but it consists of only basic editing features. The plugin I'm working on 
> gives you semantic highlighting, diagnostics, and completion.
> 
> Here you go with an introduction video: https://youtu.be/XHrnvswtW6o
> 
> The implementation is probably not mature enough to replace an industrial 
> Python IDE or text editor yet, but hopefully I'll get there. If you'd like to 
> try it out, please be patient with eventual bugs but feel free to report them 
> to me.
> 
> Notice the plugin is actually a thin layer bridging Qt Creator and the Uaiso 
> engine[1], which is multi-language source code modeller. So if by any chance 
> you'd like to write a plugin for any other IDE or text editor, you'll get the 
> other languages out of the box (currently there's D and Go).
> 
> Any kind of feed become is welcome.
> 
> Thanks,
> Leandro
> 
> [1] https://github.com/ltcmelo/uaiso

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

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[issue23883] __all__ lists are incomplete

2016-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 62e925be0aff by Serhiy Storchaka in branch 'default':
Issue #23883: Removed redundant names from blacklists.
https://hg.python.org/cpython/rev/62e925be0aff

--

___
Python tracker 

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



Pyton install Landmine

2016-01-16 Thread JeffP

Hi
I installed pyth3.5 on my Windows machine and had some complications 
trying  to connect other components.
I installed to the default directory chosen by the installer but that 
included a folder with an embedded space in the name. BIG NO NO


Thanks for a great tool!
Jeff

--
Jeff Petersen
Developer
IEH Laboratories IT Support
15300 Bothell Way N.E.
Lake Forest Park, Wa. 98155
Office: 206-522-5432

This message is intended only for the use of the individual or entity to which 
it is addressed and may contain information that is privileged, confidential, 
and exempt from disclosure under applicable law. If the reader of this message 
is not the intended recipient, you are hereby notified that any dissemination, 
distribution, or copying of this communication is strictly prohibited. If you 
have received this message in error, please notify us immediately by telephone 
and delete or destroy the original message.

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


Re: Using 'Or'

2016-01-16 Thread Alister

On 15/01/16 20:24, Kitten Corner wrote:

Hi, I have python version 3.5.1 and I am working on a project, I'm trying
to make it by using the 'or' sequence, I'm trying to make it do 1 thing or
the other, here's an example: print('i like pie' or 'i like donuts'), it
only does the thing that's before the 'or', please help!

From,
Kitten Corner



Conditional operators (or and not == etc.) need to be used in a test

how else would you expect you print statement to be able to decided 
which to print?


see if you can work through the code below

food="input food ?"
if food =='pie' or food=='donuts':
print ('I like %s'%food)
else:
print ('I dont like %s'%food'

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


[issue24905] Allow incremental I/O to blobs in sqlite3

2016-01-16 Thread SilentGhost

Changes by SilentGhost :


--
components: +Extension Modules
nosy: +ghaering

___
Python tracker 

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



Re: Post processing contour plot, how?

2016-01-16 Thread Martin Schöön
Den 2016-01-14 skrev Cody Piersall :
> Sorry for the short response, but check out this Stack Overflow
> question/answer
>
> http://stackoverflow.com/q/5666056/1612701
>
Thanks, this is a way forward -- not as straight forward as in
Scilab but better than writing my own find-contour algorithm.
(I think)

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


Re: Using 'Or'

2016-01-16 Thread Christian Gollwitzer

Am 15.01.16 um 21:24 schrieb Kitten Corner:

Hi, I have python version 3.5.1 and I am working on a project, I'm trying
to make it by using the 'or' sequence, I'm trying to make it do 1 thing or
the other, here's an example:



print('i like pie' or 'i like donuts')



it only does the thing that's before the 'or', please help!


I think you misunderstand what "or" does. It evaluates the first 
expression, and if this is false, it evaluates the second. The empty 
string is considered false in Python, so, if you modfiy your example:


print('' or 'i like donuts')

it'll print the second thing 'i like donuts'.

'or' does not choose randomly between both sides - if you are looking 
for that, check


>>> import random
>>> random.choice(('donuts','apples'))
'donuts'
>>> random.choice(('donuts','apples'))
'apples'
>>> random.choice(('donuts','apples'))
'donuts'
>>>


Christian

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


Is there a limit to the characters used in a print statement?

2016-01-16 Thread Robert James Liguori
I'm doing a data conversion and all is garbled when I add an extra hundred 
lines to the print in my for loop.  Is there a limit?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26132] 2.7.11 Windows Installer issues on Win2008R2

2016-01-16 Thread SilentGhost

Changes by SilentGhost :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue25251] Unknown MS Compiler version 1900

2016-01-16 Thread Marcelo Duarte

Marcelo Duarte added the comment:

I hava a problem with others packages, like cchardet and aiohttp.
Aplying the patch changed the error message, then I generate a lib for 
vcruntime140, and finally, it is installed:

#go to python installation dir
cd M:\Applications\Python35-32
pexports vcruntime140.dll >libs\vcruntime140.def
dlltool -dllname vcruntime140.dll --def libs\vcruntime140.def --output-lib 
libs\libvcruntime140.a

--
nosy: +marcelotduarte

___
Python tracker 

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



[issue26135] Documentation Recommends Deprecated `imp` Module

2016-01-16 Thread Cameron Conn

New submission from Cameron Conn:

The documentation detailing modules recommends using the deprecated `imp` 
module in section 6.1. Instead, it should recommend `importlib`, which `imp` 
was deprecated in favor of in Python 3.4.

The portion of the documentation that says this is in the gray aside box at the 
bottom of Section 6.1 immediately before Section 6.1.1.

These are the pages that have this issue:
Python 3.4: https://docs.python.org/3.4/tutorial/modules.html#more-on-modules
Python 3.5: https://docs.python.org/3.5/tutorial/modules.html#more-on-modules
Python 3.6: https://docs.python.org/3.6/tutorial/modules.html#more-on-modules

--
assignee: docs@python
components: Documentation
messages: 258438
nosy: camconn, docs@python
priority: normal
severity: normal
status: open
title: Documentation Recommends Deprecated `imp` Module
type: enhancement
versions: 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



[issue24780] unittest assertEqual difference output foiled by newlines

2016-01-16 Thread Emanuel Barry

Changes by Emanuel Barry :


--
components: +Tests
stage: test needed -> needs patch

___
Python tracker 

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



[issue21762] update the import machinery to only use __spec__

2016-01-16 Thread Nick Coghlan

Nick Coghlan added the comment:

That approach sounds good to me.

The main problem cases I'm aware of are:

__name__:

* reliably wrong in __main__
* the attribute you mess with if you want __qualname__ on functions and classes 
to be different so that pickle will import them from somewhere else (e.g. a 
parent package)

__path__:

* used for dynamic package definitions (including namespace package emulation)

__package__:

* AFAIK, mainly useful as a workaround for other people doing "bad things" 
(TM), like running package submodules directly as __main__ rather than using 
the -m switch

--

___
Python tracker 

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



[issue26069] Remove the Deprecated API in trace module

2016-01-16 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Thanks for the pointers, Berker. That was very helpful and I will keep in mind 
when evaluating other deprecated apis. 

For the trace module, I will add this removal information in 
Doc/whatsnew/3.6.rst

--

___
Python tracker 

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



Re: Pyton install Landmine

2016-01-16 Thread Ian Kelly
On Jan 16, 2016 3:02 AM, "JeffP"  wrote:
>
> Hi
> I installed pyth3.5 on my Windows machine and had some complications
trying  to connect other components.
> I installed to the default directory chosen by the installer but that
included a folder with an embedded space in the name. BIG NO NO

Program Files is the standard Windows installation location for non-OS
software and is selected as the default location as a security practice. If
the other components to which you refer are designed for Windows but cannot
correctly handle the space in Program Files, that sounds like a problem
with those components, not with Python.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24780] unittest assertEqual difference output foiled by newlines

2016-01-16 Thread anchal agarwal

Changes by anchal agarwal :


Added file: http://bugs.python.org/file41636/test.py

___
Python tracker 

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



[issue26134] HTTPPasswordMgrWithPriorAuth does not work with DigestAuthentication

2016-01-16 Thread Martin Panter

Martin Panter added the comment:

Despite the title of the other report, it looks like we ended up having a 
HTTPPasswordMgrWithPriorAuth class instead, and there is no longer a 
HTTPBasicPriorAuthHandler class. Also, if this proposal could work, it would 
have to go into a new version of Python; 3.5 has already been released.

With Basic authentication, the client can easily pre-empt an Authorization 
field, because it sends the username and password in the clear. I have less 
understanding of Digest authentication, but it is described in 
. I understand the client first needs a 
“nonce” value issued by the server before it can generate the Authorization 
field.

You gave some demonstration code. Can you explain what the code should be doing 
at the HTTP level? Do you have any example server, use case, or something that 
this would work with? What were you looking for with Wireshark? I suspect you 
would need to include the nonce or some previous session object with the 
password manager.

The code to generate the Authorization field with Basic authentication is in 
AbstractBasicAuthHandler.http_request(): 
. For 
comparison, the Digest data for the Authorization field is generated in 
AbstractDigestAuthHandler.get_authorization(). See how it requires the “chal” 
parameter, derived from an Authorization response field.

--
nosy: +martin.panter
stage:  -> test needed
title: urllib2.HTTPBasicPriorAuthHandler does not work with 
DigestAuthentication -> HTTPPasswordMgrWithPriorAuth does not work with 
DigestAuthentication
type:  -> enhancement
versions: +Python 3.6 -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: Stop writing Python 4 incompatible code

2016-01-16 Thread Chris Angelico
On Sun, Jan 17, 2016 at 6:26 AM, Michael Torrie  wrote:
> On 01/16/2016 11:00 AM, William Ray Wing wrote:
>> It was known at the time. It was certainly known by the companies
>> that were ripped off, but they were typically small to really small
>> and couldn’t get traction for their stories in a press that was in
>> thrall to Microsoft.  It was pretty much only mentioned by contrarian
>> writers like Cringely, and for the most part was lost in the noise
>> over the browser war.
>
> Stac, the company who Microsoft ripped off to make DoubleSpace, did
> successfully sue MS and won (fairly big time).  MS ended up paying them
> a fair sum of money in damages.  But it was too late by then. Stac's
> original product, and MS DoubleSpace, was no longer really in demand  as
> hard drive prices fell and speeds increased.

Not to mention the massive MASSIVE risks of doublespacing your drive -
like total data loss. Even after it was made more reliable, the
reputation was shot. Nobody I spoke to would ever trust that kind of
drive-level compression.

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


Re: Stop writing Python 4 incompatible code

2016-01-16 Thread Christopher Reimer

On 1/15/2016 10:09 AM, Bernardo Sulzbach wrote:

On Fri, Jan 15, 2016 at 3:02 PM, William Ray Wing  wrote:

What Micro$oft was actually sued for was worse.  They would approach a small 
company: “We like your product/technology, we think we are interested in buying 
you out, but we want to see your code to be sure it is 
modular/well-documented/etc.”  Then, after looking over the code: “Well, it 
actually doesn’t fit our plans.  Sorry.”  Six months or so later, essentially 
identical stuff would turn up in a Micro$soft product.


More out of curiosity than anything else, do you have a source?



I thought I replied to this a few days ago from my iPhone but I haven't 
seen my response show up on the list. My apologies if this becomes a dupe.


My favorite book is "Startup: A Silicon Valley Adventure" by Jerry 
Kaplan. He developed the first pen-based computer in the late 1980's 
that became the precursor for PDA's in the 1990's. After showing off the 
prototype to Apple, IBM and Microsoft, they all screwed him over by 
developing competing products within a few years. Microsoft was able to 
bring in an engineer to examine the electronic schematics and source 
code, decline any interest in the product, and form a development team 
for a pen-based Windows version. The venture capitalists squeezed the 
founders out and dismantled the company.


Although out of print for a good many years, the book is now available 
as an ebook.


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


[issue25458] ftplib: command response shift - mismatch

2016-01-16 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +giampaolo.rodola
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue26077] Make slicing of immutable structures return a view instead of a copy

2016-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The support of sharing a content between different tuples requires changing the 
structure of the tuple object, allocating additional block for every tuple, 
adding a level of indirection and reference counting. This will increase memory 
consumption, creating and access time for all tuples. All this is critically 
important for Python interpreter. I think this idea has no a chance.

--
nosy: +serhiy.storchaka
resolution:  -> rejected
stage: needs patch -> 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: Using 'Or'

2016-01-16 Thread Steven D'Aprano
On Sat, Jan 16, 2016 at 7:24 AM, Kitten Corner 
wrote:
> Hi, I have python version 3.5.1 and I am working on a project, I'm trying
> to make it by using the 'or' sequence, I'm trying to make it do 1 thing
> or the other, here's an example: print('i like pie' or 'i like donuts'),
> it only does the thing that's before the 'or', please help!


It's hard to say what is wrong if you don't tell us what you expect. What
*do* you expect 

print('i like pie' or 'i like donuts')

to print?

(1) Always the first;

(2) Always the second;

(3) Read my mind and tell me whether I want pie or donuts right now;

(4) Randomly pick one;

(5) Something else?


I can tell you that number (3) is never going to happen :-)

My guess is that you want number (4), is that right? Unfortunately, that's
not what `or` does in Python. To print a random string in Python, probably
the best way is this:


import random
choices = ["I like pie, , pie!", 
   "I like donuts. Sweet, delicious donuts.",
   "I like cookies. Gimme more cookies!",
   "I like liver and onions. With extra liver. Hold the onions."]
print(random.choice(choices))



`or` operates differently. It takes two arguments, and it picks the first
one which is "truthy". (Truthy means "true, or something kinda like true".)
Now obviously Python cannot possibly tell whether you *actually do* like
pie or not, so what does "truthy" mean here?

In Python's case, it takes the empty string "" as false, and all other
strings as true. So:


py> "hello" or "goodbye"  # choose the first truthy string
'hello'
py> "goodbye" or "hello"
'goodbye'
py> "" or "something"
'something'


Think of `or` as the following:

- if the first string is the empty string, return the second string;
- otherwise always return the first string.




-- 
Steven

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


print size limit

2016-01-16 Thread gliesian66
I'm doing a format conversion and all works fine until I add another 100 
characters... haven't determined exactly where the breaking point is... but the 
initial conversion gets truncated and then fixes itself a little while in.  Is 
there a limit on the print statement or the print statement nested in a for 
loop?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Ramin Farajpour Cami

Ramin Farajpour Cami added the comment:

Yes!I use python version 2.7.11 and my Windows machine stop and crashed, on cmd 
Windows,

--
status: pending -> open

___
Python tracker 

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



[issue26049] Poor performance when reading large xmlrpc data

2016-01-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> patch review

___
Python tracker 

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



[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Ramin Farajpour Cami

Ramin Farajpour Cami added the comment:

i test python version 2.7.11 32 bit i get your error , but 64 bit no crashed,


CommandLine: python.exe
Symbol search path is: 
srv*c:\pubsymbols*http://msdl.microsoft.com/download/symbols
Executable search path is:
ModLoad: 1c3c 1c3cb000   python.exe
ModLoad: 7702 77199000   ntdll.dll
ModLoad: 76d0 76df   C:\Windows\SysWOW64\KERNEL32.DLL
ModLoad: 76ea 77016000   C:\Windows\SysWOW64\KERNELBASE.dll
ModLoad: 5fd7 5fffe000   C:\Windows\SysWOW64\python27.dll
ModLoad: 71de 71e83000   
C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9158_none_5091b51ebcb97cdc\MSVCR90.dll
ModLoad: 7697 76ab   C:\Windows\SysWOW64\USER32.dll
ModLoad: 7614 7628d000   C:\Windows\SysWOW64\GDI32.dll
ModLoad: 76b1 76b8b000   C:\Windows\SysWOW64\ADVAPI32.dll
ModLoad: 76c4 76cfe000   C:\Windows\SysWOW64\msvcrt.dll
ModLoad: 75c2 75c63000   C:\Windows\SysWOW64\sechost.dll
ModLoad: 76df 76e9c000   C:\Windows\SysWOW64\RPCRT4.dll
ModLoad: 7413 7414e000   C:\Windows\SysWOW64\SspiCli.dll
ModLoad: 7412 7412a000   C:\Windows\SysWOW64\CRYPTBASE.dll
ModLoad: 740c 74119000   C:\Windows\SysWOW64\bcryptPrimitives.dll
ModLoad: 7415 7550e000   C:\Windows\SysWOW64\SHELL32.dll
ModLoad: 7551 759ec000   C:\Windows\SysWOW64\windows.storage.dll
ModLoad: 75c8 75e3a000   C:\Windows\SysWOW64\combase.dll
ModLoad: 76bf 76c34000   C:\Windows\SysWOW64\shlwapi.dll
ModLoad: 7629 7629c000   C:\Windows\SysWOW64\kernel.appcore.dll
ModLoad: 768e 7696d000   C:\Windows\SysWOW64\shcore.dll
ModLoad: 76ac 76b04000   C:\Windows\SysWOW64\powrprof.dll
ModLoad: 76ab 76abf000   C:\Windows\SysWOW64\profapi.dll
ModLoad: 768b 768db000   C:\Windows\SysWOW64\IMM32.DLL
ModLoad: 75fb 760d   C:\Windows\SysWOW64\MSCTF.dll
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import strop
>>> strop.replace("\x100"*0xEAAA,"\x100","AA"*0x)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError

--

___
Python tracker 

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



Re: Deploy Python script on Apache using mod_wsgi

2016-01-16 Thread Alister

On 15/01/16 22:33, gupta.ashish65...@gmail.com wrote:

I am trying to deploy a python script on Apache using mod_wsgi. How to write 
the wsgi file for mod_wsgi ?

I have asked my question here on http://stackoverflow.com/q/33314787/2350219


a Google search for python wsgi brings up many tutorials
--
https://mail.python.org/mailman/listinfo/python-list


Re: getkey

2016-01-16 Thread Ulli Horlacher
Ulli Horlacher  wrote:

> The first byte of an escape sequence (example: ^[[21~ for F10) is
> recognized, but the trailing bytes then are not discarded by
> clear_keyboard_buffer() and get_key() returns the second byte of the
> escape sequence.

I have found a solution:

def clear_keyboard_buffer():
  try:
while msvcrt.kbhit(): msvcrt.getwch()
  except:
fd = sys.stdin.fileno()
fcntl_flags = fcntl.fcntl(fd,fcntl.F_GETFL)
fcntl.fcntl(fd,fcntl.F_SETFL,fcntl_flags|os.O_NONBLOCK)
try:
  while sys.stdin.read(1): pass
except:
  pass
fcntl.fcntl(fd,fcntl.F_SETFL,fcntl_flags)


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Ramin Farajpour Cami

Ramin Farajpour Cami added the comment:

here version :

C:\python2711>python.exe
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import strop
>>> strop.replace("\x100"*0xEAAA,"\x100","AA"*0x)

--

___
Python tracker 

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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2016-01-16 Thread Brett Cannon

Brett Cannon added the comment:

As I commented on another issue, I think I'm going to tweak the change to 
continue to prefer __package__, but raise ImportWarning when it doesn't match 
__spec__.parent. Once we do that for all attributes we can wait until Python 
2.7 is done and then swap priority to __spec__ and raise a DeprecationWarning 
if __spec__ is missing. That way post-Python 2.7 we can move entirely to a 
spec-based import system.

--
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: Stop writing Python 4 incompatible code

2016-01-16 Thread Alister

On 15/01/16 18:55, Bernardo Sulzbach wrote:

On Fri, Jan 15, 2016 at 4:46 PM, Alister  wrote:


Doublespace disk compression springs to mind



Does not ring a bell, I was not even born for MS-DOS 6.0.



it was exactly the scenario described

A company had developed a means of impo=roving the Fat file system (IIRC 
by using a pseudo file system on top to eliminate the wasted space 
caused by incomplete blocks & the end of files)


Microsoft engaged in negotiations to include the technique in MSDOS
the pulled out at the last minute (after obtaining all the technical 
details) & introduced their own version which operated almost identically.


heck PCDos was initially written by a 3rd party who was ripped of by 
Microsoft.


Microsoft are the goto example fro the three 'E' approach to development.

Embrace
Extend
Extinguish

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


[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Ramin Farajpour Cami

Ramin Farajpour Cami added the comment:

i try install windows on VMWare and get video for you, in primary OS i my 
system crash i can't save video or image for you ,

--

___
Python tracker 

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



Re: Stop writing Python 4 incompatible code

2016-01-16 Thread paul . hermeneutic
On Sat, Jan 16, 2016 at 7:48 AM, Bernardo Sulzbach
 wrote:
> Did people know this back then or it just surfaced years later? I
> suppose that at the beginning MS was more "vulnerable" than it is
> today.

This was either pre- or early days of the Web which provided to some
degree a shroud of secrecy. Companies today just have to work harder
and pay more lawyers to keep their questionable actions from being
known.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25234] test_eintr.test_os_open hangs under Xcode 7

2016-01-16 Thread Brett Cannon

Brett Cannon added the comment:

Sure, that test can be skipped as well if it is hanging.

--
status: closed -> open

___
Python tracker 

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



[issue21762] update the import machinery to only use __spec__

2016-01-16 Thread Brett Cannon

Brett Cannon added the comment:

I totally agree proper notes in the What's New doc need to be in place to 
explain that people need to update.

How about I tweak the __package__ change to continue to prefer __package__ over 
__spec__.parent, but raise an ImportWarning when they differ? It can also fall 
back to __spec__.parent if __package__ isn't defined and simply not worry about 
the lack of __package__? Then we can do an ImportWarning for all of the other 
attributes when we discover a difference so people have time to migrate to 
updating both locations, and then eventually we can invert the priority and 
then after that drop the module attributes.

--

___
Python tracker 

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



Re: Stop writing Python 4 incompatible code

2016-01-16 Thread Bernardo Sulzbach
On Sat, Jan 16, 2016 at 12:41 PM, Alister  wrote:
> it was exactly the scenario described
>
> A company had developed a means of impo=roving the Fat file system (IIRC by
> using a pseudo file system on top to eliminate the wasted space caused by
> incomplete blocks & the end of files)
>
> Microsoft engaged in negotiations to include the technique in MSDOS
> the pulled out at the last minute (after obtaining all the technical
> details) & introduced their own version which operated almost identically.
>
> heck PCDos was initially written by a 3rd party who was ripped of by
> Microsoft.
>
> Microsoft are the goto example fro the three 'E' approach to development.
>
> Embrace
> Extend
> Extinguish

Did people know this back then or it just surfaced years later? I
suppose that at the beginning MS was more "vulnerable" than it is
today.

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


[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Ramin Farajpour Cami

Ramin Farajpour Cami added the comment:

i trust me ,i don't undrestand :( , work for me this print 
strop.replace("\x100"*0xEAAA,"\x100","AA"*0x) .

now test again my system machine crash and i restart windows,


my info system :


Host Name: DESKTOP-84QSQQ8
OS Name:   Microsoft Windows 10 Enterprise
OS Version:10.0.10240 N/A Build 10240
OS Manufacturer:   Microsoft Corporation
OS Configuration:  Standalone Workstation
OS Build Type: Multiprocessor Free
Registered Owner:  RaminFP
Registered Organization:
Product ID:00329-0-3-AA066
Original Install Date: 11/6/2015, 6:12:53 AM
System Boot Time:  1/16/2016, 6:57:16 PM
System Manufacturer:   ASUSTeK Computer Inc.
System Model:  K52DY
System Type:   x64-based PC
Processor(s):  1 Processor(s) Installed.
   [01]: AMD64 Family 16 Model 5 Stepping 3 
AuthenticAMD ~1800 Mhz
BIOS Version:  American Megatrends Inc. K52DY.207, 1/27/2011
Windows Directory: C:\Windows
System Directory:  C:\Windows\system32
Boot Device:   \Device\HarddiskVolume2
System Locale: en-us;English (United States)
Input Locale:  en-us;English (United States)
Time Zone: (UTC+03:30) Tehran
Total Physical Memory: 4,094 MB
Available Physical Memory: 1,967 MB
Virtual Memory: Max Size:  6,270 MB
Virtual Memory: Available: 4,152 MB
Virtual Memory: In Use:2,118 MB
Page File Location(s): C:\pagefile.sys
Domain:WORKGROUP
Logon Server:  \\DESKTOP-84QSQQ8
Hotfix(s): 5 Hotfix(s) Installed.
   [01]: KB3087040
   [02]: KB3106932
   [03]: KB3116869
   [04]: KB3124266
   [05]: KB3133431
Network Card(s):   6 NIC(s) Installed.
   [01]: Qualcomm Atheros AR9002WB-1NG Wireless Network 
Adapter
 Connection Name: Wi-Fi
 DHCP Enabled:Yes
 DHCP Server: 192.168.1.1
 IP address(es)
 [01]: 192.168.1.101
 [02]: fe80::1d3d:b7fa:e576:7111
   [02]: JMicron PCI Express Gigabit Ethernet Adapter
 Connection Name: Ethernet
 Status:  Hardware not present
   [03]: Kerio Virtual Network Adapter
 Connection Name: Ethernet 5
 Status:  Media disconnected
   [04]: VMware Virtual Ethernet Adapter for VMnet1
 Connection Name: Ethernet 2
 Status:  Hardware not present
   [05]: Cisco AnyConnect Secure Mobility Client 
Virtual Miniport Adapter for Windows x64
 Connection Name: Ethernet 6
 Status:  Hardware not present
   [06]: VMware Virtual Ethernet Adapter for VMnet8
 Connection Name: Ethernet 3
 Status:  Hardware not present
Hyper-V Requirements:  VM Monitor Mode Extensions: Yes
   Virtualization Enabled In Firmware: Yes
   Second Level Address Translation: Yes
   Data Execution Prevention Available: Yes

--

___
Python tracker 

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



[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Ramin Farajpour Cami

Ramin Farajpour Cami added the comment:

also work it , windows 7 OS 64bit with python 2.7.11 64bit,

this is a vulnerability in python 2.7.11 64bit version,

please look video,

https://drive.google.com/file/d/0B0zktfkIvV-LajlIQ0p0eWZjd0U/view

--

___
Python tracker 

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



[issue9006] xml-rpc Server object does not propagate the encoding to Unmarshaller

2016-01-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

xmlrpc uses XML. This format includes information about the encoding and 
doesn't need external specification.

The server in the example is not correct. It generates XML with default XML 
declaration that implies the UTF-8 encoding, but the body is encoded with 
non-UTF-8 encoding. If add the argument encoding='UTF-8' the example works.

But this feature is not covered by tests. Proposed patch adds tests for 
non-default client and server encodings. No changes for the xmlrpc module 
itself is needed.

--
assignee:  -> serhiy.storchaka
components: +Tests
keywords: +patch
nosy: +serhiy.storchaka
stage:  -> patch review
type: behavior -> enhancement
versions: +Python 3.5, Python 3.6 -Python 3.1, Python 3.2
Added file: http://bugs.python.org/file41633/test_xmlrpc_encoding-2.7.patch

___
Python tracker 

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



[issue25089] Can't run Python Launcher on Windows

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

I've added a brief doc section on modifying and removing the install, so 
hopefully that suffices for this issue. If the original issue occurs again, 
feel free to reopen, but I think it'll be okay.

I have a few ideas about changing the installer to be more intuitive, but those 
would be separate.

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



[issue25287] test_crypt fails on OpenBSD

2016-01-16 Thread Cédric Krier

Changes by Cédric Krier :


--
nosy: +ced

___
Python tracker 

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



[issue25850] Building extensions with MSVC 2015 Express fails

2016-01-16 Thread Steve Dower

Changes by Steve Dower :


--
assignee:  -> steve.dower
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
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



[issue25850] Building extensions with MSVC 2015 Express fails

2016-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fc117df27143 by Steve Dower in branch '3.5':
Issue #25850: Use cross-compilation by default for 64-bit Windows.
https://hg.python.org/cpython/rev/fc117df27143

New changeset 37dc870175be by Steve Dower in branch 'default':
Issue #25850: Use cross-compilation by default for 64-bit Windows.
https://hg.python.org/cpython/rev/37dc870175be

--
nosy: +python-dev

___
Python tracker 

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



[issue25993] Crashed when call time.time() after using _mm_xor_si64

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

This is something that you need to fix in the code using MMX. I don't recall 
the details, but there is an instruction that needs to be executed between 
using MMX and using the FPU.

Python can't make this judgement every time it calls into native code, so the 
external code has to do it.

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

___
Python tracker 

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



[issue26073] Update the list of magic numbers in launcher

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

Thanks!

--
assignee:  -> steve.dower
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



[issue26070] Launcher fails to find in-place built binaries from earlier Python versions

2016-01-16 Thread Steve Dower

Changes by Steve Dower :


--
assignee:  -> mhammond
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



[issue25694] test.libregrtest not installed

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

@Victor - is there anything else to be done for this issue or can we close it?

--

___
Python tracker 

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



[issue25878] CPython on Windows builds with /W3, not /W4

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

libmpdec/memory.c keeps pointers to customisable memory functions (malloc/free) 
and initialises them to  and  These functions are dllimport'd from 
the CRT, and so they trigger a warning letting you know that " == 
" may not always be true.

(That trivial comparison should always be true, but if you indirect one of the 
values through a few other modules it may be an address of a different stub 
function that calls the real malloc, and hence the addresses may not match.)

--

___
Python tracker 

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



Re: print size limit

2016-01-16 Thread Steven D'Aprano
On Sun, 17 Jan 2016 12:48 am, gliesia...@gmail.com wrote:

> I'm doing a format conversion and all works fine until I add another 100
> characters... 

And then what happens?

How many characters do you convert before that point?

What does this "format conversion" do?


> haven't determined exactly where the breaking point is... 

That's okay, you've determined where it is, plus or minus 50 characters. You
know that everything is fine up to some mystery N characters, then you add
100 characters and something mysterious happens, so the breaking point has
to be in the range N+1 to N+100.

> but the initial conversion gets truncated and then fixes itself a little
> while in.  

Huh? How can it fix itself? What do you mean "gets truncated"? I would start
by looking at the code of this "format conversion" and see what it does.


> Is there a limit on the print statement or the print statement 
> nested in a for loop?

What does the print statement got to do with this? Above, you say that the
problem is the mystery "format conversion".

Perhaps if you show us some working code that demonstrates the problem,
instead of talking in vague generalities, we might be able to suggest a
solution.




-- 
Steven

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


[issue26133] TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object in

2016-01-16 Thread Guido van Rossum

Guido van Rossum added the comment:

Victor, if the signal module has been cleared, how could it emit that error
message? signal.signal itself would no longer exist.

(I do agree with the solution you suggest -- though note that it may be
tricky to close the loop from inside the signal callback for SIGTERM, which
is presumably what is going on here.)

--

___
Python tracker 

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



[issue25694] test.libregrtest not installed

2016-01-16 Thread Steve Dower

Changes by Steve Dower :


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



Re: Using 'Or'

2016-01-16 Thread Chris Angelico
On Sun, Jan 17, 2016 at 9:47 AM, Alister  wrote:
> On 16/01/16 21:53, Steven D'Aprano wrote:
>>
>> On Sun, 17 Jan 2016 01:06 am, Alister wrote:
>>
>>> Conditional operators (or and not == etc.) need to be used in a test
>>
>>
>> Technically, that is incorrect.
>
> yes but the op is confused in his usage enough at present

Adding a falsehood sometimes helps reduce the confusion, but in this
case it just worsens things, I think.

>>> how else would you expect you print statement to be able to decided
>>> which to print?
>>
>>
>>
>> default = "I like Brussels sprouts."
>> message = random.choice(["", "I like boiled cabbage."])
>> print( message or default )
>>
>>
>>
> I hope I never see production code like that

Why? Okay, maybe not with a random.choice, but what about dict lookup?

specific_messages = {
 "foo": "You use a new foo.",
"bar": "You sing a few bars of music.",
}
print(specific_messages.get(kwd) or "You {} vehemently.".format(kwd))

Seems fine to me.

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


[issue26133] TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object in

2016-01-16 Thread Alex Brandt

New submission from Alex Brandt:

When using the suggested practice of setting a stop loop signal handler with:

loop.add_signal_handler(signal.SIGTERM, loop.stop)

The following stack trace is given when the signal runs:

ligament_1 | Exception ignored in: >
ligament_1 | Traceback (most recent call last):
ligament_1 |   File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in 
__del__
ligament_1 |   File "/usr/lib/python3.5/asyncio/unix_events.py", line 58, in 
close
ligament_1 |   File "/usr/lib/python3.5/asyncio/unix_events.py", line 139, in 
remove_signal_handler
ligament_1 |   File "/usr/lib/python3.5/signal.py", line 47, in signal
ligament_1 | TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, 
or a callable object

Since this happens during shutdown of the application I wouldn't consider this 
a high priority bug but it is quite annoying.  I've also not investigated if 
this interrupts the loop stopping procedure yet.

--
components: asyncio
messages: 258401
nosy: Alex Brandt, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a 
callable object in >
type: crash
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



[issue26133] TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object in

2016-01-16 Thread Guido van Rossum

Guido van Rossum added the comment:

Heh, this is weird. If the signal being removed is SIGTERM, the logic looks 
like it is definitely going to call signal.signal(signal.SIGTERM, 
signal.SIG_DFL). And it doesn't look like the signal module's globals have been 
eradicated yet (or you'd have gotten something like "TypeError: 'NoneType' 
object is not callable" instead).

You seem to be using Python 3.5.0.  Can you repro this with 3.5.1 or with the 
asyncio from github? Do you have a small self-contained program that repos it?

--

___
Python tracker 

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



[issue25799] 2.7.11rc1 not added to Win10 app list (start menu)

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

Terry, have you had a chance to try this with 2.7.11 final? (We didn't change 
anything, so I have no reason to expect anything difference.)

Without broader confirmation that this is an issue, I don't see how we can keep 
it as a release blocker. I also have no idea how to investigate or resolve it 
without a machine that regularly repros.

--

___
Python tracker 

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



Re: Python best practices

2016-01-16 Thread Felix Almeida

Pylint is your friend: http://www.pylint.org/

If you already know a bit about the language then a good place to start 
is the Google Python Style Guide: 
https://google.github.io/styleguide/pyguide.html




On 15/01/16 08:19 PM, gliesia...@gmail.com wrote:

Are there any good resources on python best practices?  e.g., articles

Thanks,
Robert



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


[issue25850] Building extensions with MSVC 2015 Express fails

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

For anyone interested, there's no issue with using the cross compilers even on 
a 64-bit system. The same code will be generated, the only difference is that 
the native 64-bit compilers can keep more in memory than the 32-bit cross 
compilers. For most Python extensions this won't matter (it matters for 
building huge projects like an operating system).

--

___
Python tracker 

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



[issue24840] implement bool conversion for enums to prevent odd edge case

2016-01-16 Thread Ethan Furman

Ethan Furman added the comment:

New changeset e4c22eadc25c:

use public 'value'

--

___
Python tracker 

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



[issue25778] winreg.EnumValue does not truncate strings correctly

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

Zach - you still got this or do you want me to commit it?

--

___
Python tracker 

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



[issue24505] shutil.which wrong result on Windows

2016-01-16 Thread Toby Tobkin

Toby Tobkin added the comment:

Steve, yeah I saw that and started playing with Clinic last night. I'll have 
the updated patch out soon--I've just been slow because I've been flying around 
to interviews trying to get my first job out of college and it's been eating 
all my free time.

--

___
Python tracker 

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



[issue25824] 32-bit 2.7.11 installer creates registry keys that are incompatible with the installed python27.dll

2016-01-16 Thread Steve Dower

Changes by Steve Dower :


--
assignee:  -> steve.dower
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



[issue25824] 32-bit 2.7.11 installer creates registry keys that are incompatible with the installed python27.dll

2016-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b91c323a605e by Steve Dower in branch '2.7':
Issue #25824: Fixes sys.winver to not include any architecture suffix.
https://hg.python.org/cpython/rev/b91c323a605e

--
nosy: +python-dev

___
Python tracker 

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



[issue26073] Update the list of magic numbers in launcher

2016-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1a2cfa52f749 by Steve Dower in branch '3.5':
Issue #26073: Update the list of magic numbers in launcher
https://hg.python.org/cpython/rev/1a2cfa52f749

New changeset cf868f77b400 by Steve Dower in branch 'default':
Issue #26073: Update the list of magic numbers in launcher
https://hg.python.org/cpython/rev/cf868f77b400

--
nosy: +python-dev

___
Python tracker 

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



Re: Python best practices

2016-01-16 Thread Bob Gailer
On Jan 15, 2016 8:20 PM,  wrote:
>
> Are there any good resources on python best practices?  e.g., articles

What programming experience do you have? I'm thinking of languages.

Here are a few of my guidelines - most not Python specific:

Keep logic and data separate.

Comment early and often - but don't comment the obvious.

Use meaningful names.

Read the manuals.

Get familiar with modules. Someone has likely already solved the problem.

Do not override built-in names.

Follow these email lists.

Avoid things like "if valid == True:".
"if valid:" is sufficient.

Read the manuals.

When asking for help:
  Use a problem-specific subject.
  Use plain text so code keeps indentation
  Mention your Python version and OS.
  Include any traceback.

If something is not clear try it in the interactive window.

Dictionaries are very useful. Get familiar with them.

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


[issue26059] Integer Overflow in strop.replace()

2016-01-16 Thread Martin Panter

Martin Panter added the comment:

Looking at the 2.7.11 code, I think it should fail properly at this line 
, which 
checks if the change in size of all the replacements overflows. Is there a way 
to get a stack trace or similar on Windows?

Your video only shows the operation taking a long time or hanging as far as I 
can tell, not the Python program crashing. I would expect the call to raise 
MemoryError fairly quickly, after it has counted all 0xEAAA bytes to replace 
(but not actually replaced them).

--
nosy: +martin.panter

___
Python tracker 

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



[issue24505] shutil.which wrong result on Windows

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

I'm good with the patch, except we can't use ctypes in the standard library. 
NeedCurrentDirectoryForExePathW will need to be wrapped in Modules/_winapi.c.

Should be fairly simple to do, though it probably requires learning argument 
clinic (which admittedly I haven't done enough to write the function without 
copying from elsewhere). I may get back to it eventually, but if someone posts 
the implementation separately I'm happy to merge two patches to get this in.

--

___
Python tracker 

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



[issue25644] Unable to open IDLE on Windows 10 with Python 2.7.10

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

Closing as norepro, but happy to reopen if it's still an issue with the 
official release.

--
resolution:  -> works for me
status: open -> closed

___
Python tracker 

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



[issue26108] Calling PyInitialize with 2.7.11 on Windows x64 terminates process

2016-01-16 Thread Steve Dower

Changes by Steve Dower :


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

___
Python tracker 

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



[issue26071] bdist_wininst created binaries fail to start and find 32bit Pythons

2016-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset daa6fdaf9835 by Steve Dower in branch '3.5':
Issue #26071: bdist_wininst created binaries fail to start and find 32bit Python
https://hg.python.org/cpython/rev/daa6fdaf9835

New changeset db74f3a4cbeb by Steve Dower in branch 'default':
Issue #26071: bdist_wininst created binaries fail to start and find 32bit Python
https://hg.python.org/cpython/rev/db74f3a4cbeb

--
nosy: +python-dev

___
Python tracker 

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



Keen eyes

2016-01-16 Thread jonas . thornvall
This is not python just a short snippet of javascript that refuse tracing, i've 
staired blind upon it but since it does something weird with allocating memory 
i have no idea what is going on and the parrots and monkeys at 
comp.lang.javascript refuse to give a hint.

Something in those loops really wrong but it is no giant numbers.



function factor_it(i){
prime=true;
sqroot=Math.floor(Math.sqrt(i));
for (j=2;j

Re: Keen eyes

2016-01-16 Thread Chris Angelico
On Sun, Jan 17, 2016 at 9:23 AM,   wrote:
> function factor_it(i){
> prime=true;
> sqroot=Math.floor(Math.sqrt(i));
> for (j=2;j prime}}
> return prime;
> }

A couple of potential problems here. The first thing that comes to
mind is that floating point inaccuracy is going to bite you long
before the numbers "seem huge" to someone who's thinking about 2**53.
The second is an off-by-one error: a perfect square may come up as
prime.

Check for those and see how it looks.

Also, check your double-use of the 'prime' variable, which also
appears to be global here.

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


Re: Using 'Or'

2016-01-16 Thread Bernardo Sulzbach
On Sat, Jan 16, 2016 at 8:47 PM, Alister  wrote:
>>
>> default = "I like Brussels sprouts."
>> message = random.choice(["", "I like boiled cabbage."])
>> print( message or default )
>>
>>
>>
> I hope I never see production code like that
>

I agree. If you are going to use spaces after '(' and before ')' at
least be consistent.

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


[issue25878] CPython on Windows builds with /W3, not /W4

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

I made a new patch to replace all of the existing ones here with the two-line 
version of the change.

I also suppressed warning 4232 about dllimport addresses (essentially, you may 
get different values when taking the address of an imported function because of 
the way thunks are generated at compile time - this doesn't matter when you are 
calling them, only when comparing them), mainly because there's no other way to 
suppress them.

All warnings about conversions should be suppressed when you make the 
conversion explicit, and that's the preferable way to fix those.

--
Added file: http://bugs.python.org/file41635/25878_1.patch

___
Python tracker 

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



[issue26065] python embedded 3.5 amd64 crash when using venv

2016-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 84101e587f47 by Steve Dower in branch '3.5':
Issue #26065: Excludes venv from library when generating embeddable distro.
https://hg.python.org/cpython/rev/84101e587f47

New changeset d3422b0e0cee by Steve Dower in branch 'default':
Issue #26065: Excludes venv from library when generating embeddable distro.
https://hg.python.org/cpython/rev/d3422b0e0cee

--
nosy: +python-dev

___
Python tracker 

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



[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

Checked PCBuild/readme.txt and it's pretty clear that you can only use VS 2010+ 
with the SDK and the old compiler. So I'm closing this as wontfix as we will 
not be merging support to build Python 2 with VC10 or later.

--
resolution:  -> wont fix
stage: needs patch -> 
status: open -> closed

___
Python tracker 

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



[issue25878] CPython on Windows builds with /W3, not /W4

2016-01-16 Thread Stefan Krah

Stefan Krah added the comment:

Ah, thanks!  I guess this Visual Studio behavior is not compatible
with the C-standard, but indeed there are no function pointer
comparisons in libmpdec.

--

___
Python tracker 

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



Re: Keen eyes

2016-01-16 Thread jonas . thornvall
Den lördag 16 januari 2016 kl. 23:30:48 UTC+1 skrev Chris Angelico:
> On Sun, Jan 17, 2016 at 9:23 AM,   wrote:
> > function factor_it(i){
> > prime=true;
> > sqroot=Math.floor(Math.sqrt(i));
> > for (j=2;j > {return prime}}
> > return prime;
> > }
> 
> A couple of potential problems here. The first thing that comes to
> mind is that floating point inaccuracy is going to bite you long
> before the numbers "seem huge" to someone who's thinking about 2**53.
> The second is an off-by-one error: a perfect square may come up as
> prime.
> 
> Check for those and see how it looks.
> 
> Also, check your double-use of the 'prime' variable, which also
> appears to be global here.
> 
> ChrisA

Thank you Chris, this is not really for factoring it is meant to create a 
composite sieve. Well all the legs just holding composites will be false.

Regarding the problem no number bigger than 100 is sent to the function, there 
is something weird with either the loop structure or the break.

What should happen...
j=1
i=j

1+10 break (because prime in leg)
j++; well j is 2 and so is i

2+10,2+20,2+30,2+40.2+50,2+60,2+70,2+80,2+90 ((condidion break loop i>100
j++ ->i=3
3+10 break (because prime in leg)
j++

And so on...
And as you can see the outer loop does this until j reaches ***base which is 
10***.
In all it is about 50 operations
So how can it allocate all memory?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Stop writing Python 4 incompatible code

2016-01-16 Thread William Ray Wing

> On Jan 16, 2016, at 9:48 AM, Bernardo Sulzbach  
> wrote:
> 
> On Sat, Jan 16, 2016 at 12:41 PM, Alister  wrote:
>> it was exactly the scenario described
>> 
>> A company had developed a means of impo=roving the Fat file system (IIRC by
>> using a pseudo file system on top to eliminate the wasted space caused by
>> incomplete blocks & the end of files)
>> 
>> Microsoft engaged in negotiations to include the technique in MSDOS
>> the pulled out at the last minute (after obtaining all the technical
>> details) & introduced their own version which operated almost identically.
>> 
>> heck PCDos was initially written by a 3rd party who was ripped of by
>> Microsoft.
>> 
>> Microsoft are the goto example fro the three 'E' approach to development.
>> 
>> Embrace
>> Extend
>> Extinguish
> 
> Did people know this back then or it just surfaced years later?

It was known at the time. It was certainly known by the companies that were 
ripped off, but they were typically small to really small and couldn’t get 
traction for their stories in a press that was in thrall to Micro$oft.  It was 
pretty much only mentioned by contrarian writers like Cringely, and for the 
most part was lost in the noise over the browser war.

Bill

> I
> suppose that at the beginning MS was more "vulnerable" than it is
> today.
> 
> -- 
> Bernardo Sulzbach
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


[issue25089] Can't run Python Launcher on Windows

2016-01-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5fc9bd33a712 by Steve Dower in branch '3.5':
Issue #25089: Adds short documentation section for modifying an install.
https://hg.python.org/cpython/rev/5fc9bd33a712

New changeset 4b06490cca47 by Steve Dower in branch 'default':
Issue #25089: Adds short documentation section for modifying an install.
https://hg.python.org/cpython/rev/4b06490cca47

--

___
Python tracker 

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



[issue25153] PCbuild/*.vcxproj* should use CRLF line endings

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

IMHO enabling the eol extension is the right way to deal with this. Especially 
once the GitHub migration happens - it really doesn't handle CRLF endings (or 
anything Windows) as well as Mercurial does.

--

___
Python tracker 

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



[issue25954] Python 3.5.1 installer fails on Windows 7

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

Sorry for letting this slide for a while...

Can you check (in Programs and Features, View Installed Updates) whether you 
have KB2999226 installed? If not, you can get it from 
https://support.microsoft.com/en-us/kb/2999226

In the first install, this component failed (hence the missing DLL error), and 
then in subsequent installs it wasn't re-run. I'm not sure exactly what 
happened here, but it's possible that the installation was deferred until the 
next reboot automatically. Being a Windows Update, we don't have much control 
over how these are managed and the operating system can basically do what it 
likes.

--

___
Python tracker 

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



[issue25878] CPython on Windows builds with /W3, not /W4

2016-01-16 Thread Stefan Krah

Stefan Krah added the comment:

Could you explain warning #4232 in the case of libmpdec? I thought
all files are compiled and linked together. Why is the function
imported?

--
nosy: +skrah

___
Python tracker 

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



[issue26065] python embedded 3.5 amd64 crash when using venv

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

I'm declaring using venv from the embeddable distro as unsupported, and it will 
be removed completely from the next release.

To create virtual environments, use a regular install of Python.

--
assignee:  -> steve.dower
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
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



[issue26071] bdist_wininst created binaries fail to start and find 32bit Pythons

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

Applied the patch and rebuilt the stubs, so this will show up in 3.5.2 and 3.6.

--
assignee:  -> steve.dower
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



Re: Using 'Or'

2016-01-16 Thread Steven D'Aprano
On Sun, 17 Jan 2016 01:06 am, Alister wrote:

> Conditional operators (or and not == etc.) need to be used in a test

Technically, that is incorrect.

> how else would you expect you print statement to be able to decided 
> which to print?


default = "I like Brussels sprouts."
message = random.choice(["", "I like boiled cabbage."])
print( message or default )



-- 
Steven

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


[issue25765] Installation error

2016-01-16 Thread Steve Dower

Steve Dower added the comment:

Closing as third-party, but happy to reopen if this turns out to be something 
specific to our installer and not the configuration of the target system.

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



[issue25799] 2.7.11rc1 not added to Win10 app list (start menu)

2016-01-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

'Python 2.7.11' appeared in the 'All apps' list.  The .exe also appears in the 
local search, as just 'Python'.  So this was fixed by either you in one of the 
patches between rc1 and final, Microsoft in a Win 10 update, or randon 
happenstance.

--
resolution:  -> fixed
stage: needs patch -> 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



  1   2   >