[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

середа, 23-вер-2015 10:12:35 STINNER Victor написано:
> New submission from STINNER Victor:
> 
> The Lib/test/regrtest.py file became a monster. It's very long, it uses a
> lot of global variables. It's hard to review and hard to maintain. I
> propose to:
> 
> - split single file regrtest.py into multiple files in a new
> Lib/test/regrtest/ package

You can just mover parts of the code into utility files (or to the test.support 
package) without converting regrtest.py to a package. This preserves 
compatibility with running Lib/test/regrtest.py as a script.

> - refactor the test runner as a class to avoid global variables

Global variables are not evil in a script. Are there other reasons besides 
aesthetic?

--

___
Python tracker 

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



Re: sort help

2015-09-23 Thread Larry Martell
On Tue, Sep 22, 2015 at 6:55 PM, Chris Angelico  wrote:
> On Wed, Sep 23, 2015 at 8:42 AM, Larry Martell  
> wrote:
>> I currently have 3 lists of lists and I sort them based on a common
>> field into a single list like this:
>>
>> def GetObjKey(a):
>> return a[2]
>>
>> sorted(a + b + c, key=GetObjKey)
>>
>> Which works just fine.
>>
>> But now, I need to have just the first list (a) also sub sorted by
>> another field and I can't quite figure out how to do this.
>
> Have you tried simply sorting a by the other field prior to doing your
> merge-and-sort? The Python list.sort() method is guaranteed to be
> stable. I can't find a comparable guarantee for sorted(), but worst
> case, you should be able to do your list merge, and then explicitly
> name it and sort it.

Thanks to everyone for the replied. I ended up just presorting he
first list, then merging and sorting all 3. Very simple. Not sure why
I didn't see that. Probably comes from working 75 hours/week.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread Jeremy Kloth

Changes by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue25214] asyncio ssl transport regression

2015-09-23 Thread Andrew Svetlov

Andrew Svetlov added the comment:

I've missed your patch, sorry.

Everything is fixed by http://bugs.python.org/issue25114

--
resolution:  -> duplicate
stage:  -> resolved

___
Python tracker 

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



Readlines returns non ASCII character

2015-09-23 Thread SANKAR .
Hi all,

I am not a expert programmer but I have to extract information from a large
file.
 I used  codecs.open(..) with UTF16 encoding to read this file. It could
read all the lines in the file but returns with the non Ascii characters.
Below are 5 sample lines. How do I avoid having this non Ascii items. Is
there a better way to read this?



Thanks
Sankar


‚  ÿþÿ

2 0 1 5 - 0 8 - 2 8 ÿþÿ1 7 : 2 2 : 0 3 Á   í    0ÿþÿE L E K T A _
E O S _ R T D _ V X 2 ÿþÿ ÿþÿ 0ÿþÿ ÿþÿ ÿþÿ 0ÿþÿ ÿþÿ ÿþÿ 0ÿþÿ ÿþÿ
ÿþÿ  ¸

0ÿþÿ ÿþÿM L C X ÿþÿM L C X  Pÿþÿ0 . 0 ÿþÿ0 . 0 ÿþÿ0 . 0 
Pÿþÿ  ÿþÿ  ÿþÿN o n e  Pÿþÿ
ÿþÿ  ÿþÿ0  Pÿþÿ  ÿþÿ  ÿþÿO U T 
Pÿþÿ  ÿþÿ  ÿþÿ0  Pÿþÿ
ÿþÿ  ÿþÿ- 5 . 0  Pÿþÿ  ÿþÿ  ÿþÿ6
0 . 0   Pÿþÿ  ÿþÿ  ÿþÿ0 . 5 2

 Pÿþÿ  ÿþÿ  ÿþÿ6 . 4 9

 Pÿþÿ  ÿþÿ  ÿþÿ2 0 . 0 0
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: problem building python 3.5 extensions for windows

2015-09-23 Thread Robin Becker

On 22/09/2015 22:37, cjgoh...@gmail.com wrote:

On Tuesday, September 22, 2015 at 1:49:16 PM UTC-7, Terry Reedy wrote:

On 9/22/2015 9:35 AM, Robin Becker wrote:

On 22/09/2015 11:14, Robin Becker wrote:

On 22/09/2015 01:36, CG wrote:

.t

.


Thanks for the pointer Christoph.

I certainly didn't let it run for 30 minutes. When I build with 2.7,
3.3 or 3.4
the whole build including reportlab stuff is over in a couple of
minutes. I will
try again, but a linker that takes 30 minutes to create an extension
that ends
up 204Kb long has to be seriously broken. Is it trying to hard? Most
of the code
size is in arrays for code points etc etc.


I timed my builds of pyRXPU for x86 + amd64; these are on a core i5-3470
@ 3.20Ghz with 4Gb memory.

python 3.4   1 minute  14 seconds
python 3.5  52 minutes 50 seconds

so with VS2015 it will now take me an hour to make and test any changes
to this extension. I don't see how the issue can be considered closed.
VS2015 is clearly not the way forward for any reasonable development
process.


I think you should add the above to the issue.

--
Terry Jan Reedy


It's a compiler bug. To work around, disable compiler optimizations, i.e. set 
`extra_compile_args=['/Od']` in setup.py.

--
Christoph

Thanks Christoph, I guessed it must be something like that. I suppose it's 
trying desperately to place small chunks of encoding tables or something.


--
Robin Becker

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


Re: Modify environment variable for subprocess

2015-09-23 Thread Cameron Simpson

On 23Sep2015 02:51, loial  wrote:

I need to modify the LIBPATH environment variable when running a process via 
subprocess, but otherwise retain the existing environment.

Whats the best way to do that?


Make a copy of os.environ, modify the copy, pass it via the env=parameter of 
subprocess.Popen. That is the most direct and controllable method.


Cheers,
Cameron Simpson 

Tachyon: A gluon that's not completely dry.
--
https://mail.python.org/mailman/listinfo/python-list


Re: True == 1 weirdness

2015-09-23 Thread Michael Schwarz
On 2015-09-19, at 09:19, Gregory Ewing  wrote:

> Random832 wrote:
>> I'm disputing that chained comparisons are used for the particular
>> combinations that I am actually arguing should not be used in python.
>> Such as a < b > c or a != b != c  [whereas a may or may not be equal to
>> c]
> 
> I can't remember offhand seeing a != b != c written by a
> mathematician, but if I did, I would suspect that he
> *intended* it to imply a != c, even if that's not a strict
> logical consequence of the notation.

Mathematica interprets a != b != c as "none of a, b or c are equal". See [0]. 
It does this by parsing it to Unequal[a, b, c] (square brackets are function 
calls), where Unequal then implements that operation.

Normally I'm used to Mathematica being a very consistent language. But being 
prepared by this thread, I of course wondered where the inconsistencies start 
here and whether inequalities mix well with comparisons. They don't:

While b != c != d gets parsed as this:

Unequal[b, c, d]

But a < b != c != d < e gets parsed as this:

And[Less[a, b], Unequal[b, c], Unequal[c, d], Less[d, e]]

Which means that a != b != c is interpreted differently depending on context. I 
don't think every mathematician would agree which of these interpretations make 
sense. :)

[0]: https://reference.wolfram.com/language/ref/Unequal.html


signature.asc
Description: Message signed with OpenPGP using GPGMail
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 3 windows installer problem [WAS: Re: an installing problem]

2015-09-23 Thread Lorenzo Sutton

Hi,

Not too familiar with the 'new' Python 3 installer on windows.. but

On 23/09/2015 13:37, Narges Asadi wrote:

Hello
I’ve encountered a problem when I wanted to install Python 3.5.
I  sent you the log file. Please help me to fix the problem.


From the log:

[0F4C:1110][2015-09-23T14:54:17]e000: Error 0x80072ee7: Failed to send 
request to URL: 
https://www.python.org/ftp/python/3.5.0/win32/core_pdb.msi, trying to 
process HTTP status code anyway.


which seems to be reachable now... so maybe a network problem when you 
were installing??


Look here about installing without downloading, it might be helpful.

https://docs.python.org/3/using/windows.html#installing-without-downloading

This bug report might also be relevant:
https://bugs.python.org/issue25126

Hope this helps.
Lorenzo.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Cyber Grand Challenge, prizes up to 2 million dollars ! (DARPA)

2015-09-23 Thread Skybuck Flying

Also very interesting read:

http://blog.trailofbits.com/2015/07/15/how-we-fared-in-the-cyber-grand-challenge/

"
How We Fared in the Cyber Grand Challenge
July 15, 2015 by Artem Dinaburg 6 Comments

The Cyber Grand Challenge qualifying event was held on June 3rd, at exactly 
noon Eastern time. At that instant, our Cyber Reasoning System (CRS) was 
given 131 purposely built insecure programs. During the following 24 hour 
period, our CRS was able to identify vulnerabilities in 65 of those programs 
and rewrite 94 of them to eliminate bugs built in their code. This proves, 
without a doubt, that it is not only possible but achievable to automate the 
actions of a talented software auditor.


Despite the success of our CRS at finding and patching vulnerabilities, we 
did not qualify for the final event, to be held next year. There was a fatal 
flaw that lowered our overall score to 9th, below the 7th place threshold 
for qualification. In this blog post we’ll discuss how our CRS works, how it 
performed against competitor systems, what doomed its score, and what we are 
going to do next.

Cyber Grand Challenge Background

The goal of the Cyber Grand Challenge (CGC) is to combine the speed and 
scale of automation with the reasoning capabilities of human experts. 
Multiple teams create Cyber Reasoning Systems (CRSs) that autonomously 
reason about arbitrary networked programs, prove the existence of flaws in 
those programs, and automatically formulate effective defenses against those 
flaws. How well these systems work is evaluated through head-to-head 
tournament-style competition.


The competition has two main events: the qualifying event and the final 
event. The qualifying event was held on June 3, 2015. The final event is set 
to take place during August 2016. Only the top 7 competitors from the 
qualifying event proceed to the final event.


During the qualifying event, each competitor was given the same 131 
challenges, or purposely built vulnerable programs, each of which contained 
at least one intentional vulnerability. For 24 hours, the competing CRSes 
faced off against each other and were scored according to four criteria. The 
full details are in the CGC Rules, but here’s a quick summary:


   The CRS had to work without human intervention. Any teams found to use 
human assistance were disqualified.
   The CRS had to patch bugs in challenges. Points were gained for every 
bug successfully patched. Challenges with no patched bugs received zero 
points.
   The CRS could prove bugs exist in challenges. The points from patched 
challenges were doubled if the CRS could generate an input that crashed the 
challenge.
   The patched challenges had to function and perform almost as well as the 
originals. Points were lost based on performance and functionality loss in 
the patched challenges.


A spreadsheet with all the qualifying event scores and other data used to 
make the graphs in this post is available from DARPA (Trail of Bits is the 
ninth place team). With the scoring in mind, let’s review the Trail of Bits 
CRS architecture and the design decisions we made.

Preparation

We’re a small company with a distributed workforce, so we couldn’t 
physically host a lot of servers. Naturally, we went with cloud computing to 
do processing; specifically, Amazon EC2. Those who saw our tweets know we 
used a lot of EC2 time. Most of that usage was purely out of caution.


We didn’t know how many challenges would be in the qualifying event — just 
that it would be “more than 100.” We prepared for a thousand, with each 
accompanied by multi-gigabyte network traffic captures. We were also 
terrified of an EC2 region-wide failure, so we provisioned three different 
CRS instances, one in each US-based EC2 region, affectionately named Biggie 
(us-east-1), Tupac (us-west-2), and Dre (us-west-1).


It turns out that there were only 131 challenges and no gigantic network 
captures in the qualifying event. During the qualifying event, all EC2 
regions worked normally. We could have comfortably done the qualifying event 
with 17 c4.8xlarge EC2 instances, but instead we used 297. Out of our 
abundance of caution, we over-provisioned by a factor of ~17x.

Bug Finding

The Trail of Bits CRS was ranked second by the number of verified bugs found 
(Figure 1). This result is impressive considering that we started with 
nothing while several other teams already had existing bug finding systems 
prior to CGC.


Figure 1: Teams in the qualifying event ranked by number of bugs found. 
Orange bars signify finalists.


Our CRS used a multi-pronged strategy to find bugs (Figure 2). First, there 
was fuzzing. Our fuzzer is implemented with a custom dynamic binary 
translator (DBT) capable of running several 32-bit challenges in a single 
64-bit address space. This is ideal for challenges that feature multiple 
binaries communicating with one another. The fuzzer’s instrumentation and 
mutation are separated, allowing for 

Re: Modify environment variable for subprocess

2015-09-23 Thread Laura Creighton
In a message of Wed, 23 Sep 2015 02:51:53 -0700, loial writes:
>I need to modify the LIBPATH environment variable when running a process via 
>subprocess, but otherwise retain the existing environment.
>
>Whats the best way to do that?

import subprocess, os
my_env = os.environ  # if your program should be able to modify the current env
# otherwise
my_env = os.environ.copy() # if it shouldn't

# if you just want to add something to the existing LIBPATH
my_env["LIBPATH"] = "/where/I/want/to/look/first:" + my_env["LIBPATH"]
# otherwise
my_env["LIBPATH"] = "/what/I/want"

subprocess.Popen(my_program, env=my_env)

Setting os.environ leaks memory under Mac OS and FreeBSD.
I am not sure if this means that if  you do this a gazillion times
on a Mac you will have a problem.

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


[issue25131] The AST for dict and set displays has the lineno of the first value

2015-09-23 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +3.5regression

___
Python tracker 

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



[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread STINNER Victor

New submission from STINNER Victor:

The Lib/test/regrtest.py file became a monster. It's very long, it uses a lot 
of global variables. It's hard to review and hard to maintain. I propose to:

- split single file regrtest.py into multiple files in a new Lib/test/regrtest/ 
package
- refactor the test runner as a class to avoid global variables
- refactor the multiprocessing test runner as a class in a separated file

Attached patch implements this idea.


The following commands still work:

   ./python -m test [options] [args]
   ./python -m test.regrtest [options] [args]

But the following command doesn't work anymore:

   ./python Lib/test/regrtest.py [options] [args]

If regrtest.py is executed directly on buildbots, these buildbots should be 
modified first.


The "./python -m test.regrtest" command should work on all Python versions 
(Python 2 and Python 3) and so should be preferred. The "./python -m test" 
command only works on Python 3 (thanks to the new __main__.py feature).


The change adds a new feature: it now displays name of concurrent tests running 
since 30 seconds or longer when the multiprocessing test runner is used (-j 
command line option). Example:

...
[240/399] test_uu
[241/399] test_urllib_response
[242/399] test_struct
[243/399] test_descrtut
[244/399] test_threadedtempfile
[245/399] test_tracemalloc -- running: test_concurrent_futures (30 sec)
[246/399] test_dbm_dumb -- running: test_concurrent_futures (30 sec)
[247/399] test_codeop -- running: test_concurrent_futures (30 sec)
...
[395/399/1] test_asyncio -- running: test_multiprocessing_fork (40 sec), 
test_multiprocessing_spawn (44 sec)
[396/399/1] test_faulthandler -- running: test_multiprocessing_fork (50 
sec), test_multiprocessing_spawn (54 sec)
[397/399/1] test_multiprocessing_fork (52 sec) -- running: 
test_multiprocessing_spawn (56 sec)
[398/399/1] test_multiprocessing_spawn (68 sec) -- running: 
test_multiprocessing_forkserver (39 sec)
[399/399/1] test_multiprocessing_forkserver (50 sec)

I want this feature to analysis why more and more buildbots fail with a timeout 
without saying which test was running (well, I suspect multiprocessing 
tests...).

Note: faulthandler can show where regrtest is blocked, but not when the 
multiprocessing test runner is used. And sometimes the process is killed by the 
buildbot, not by faulthandler :-/


Another minor new feature: on CTRL+c, it shows which tests are running when the 
multiprocessing test runner is used. Example:

[ 38/399] test_dummy_thread
[ 39/399] test_codecmaps_jp
[ 40/399] test_future5
^C
Waiting for test_scope, test_decimal, test_memoryview, test_heapq, 
test_unicodedata, test_trace, test_threadsignals, test_cgitb, test_runpy, 
test_cmd_line_script


Other changes:

* Show test timing when a test runs longer than 30 seconds

* Don't make __file__ absolute, findtestdir() calls os.path.abspath() instead. 
Remove these lines:

__file__ = os.path.abspath(__file__)
assert __file__ == os.path.abspath(sys.argv[0])

* print() is now called wih flush=True (it didn't check all calls, only the 
major calls), remove sys.stdout.flush() and  sys.stdout.flush()

* A lot of refactoring. Sorry, I didn't take notes for each change.


I fear that test_regrtest has a small code coverage. I only tested major 
options, I didn't test -R for example.


Note: I don't understand how the --single option works when regrtest is not run 
from the Python source code directory. A temporary directory, so the pynexttest 
file is removed after its creation, no? If it doesn't make sense to use 
--single outside Python directory, maybe an error should be raised?

--
components: Tests
files: regrtest_package.patch
keywords: patch
messages: 251419
nosy: ezio.melotti, haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Enhance and refactor test.regrtest (convert regrtest.py to a package)
versions: Python 3.6
Added file: http://bugs.python.org/file40554/regrtest_package.patch

___
Python tracker 

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



Cyber Grand Challenge, prizes up to 2 million dollars ! (DARPA)

2015-09-23 Thread Skybuck Flying

(Click on little icon on website top left for menu):

Information about challenge:

http://www.cybergrandchallenge.com/site/index.html#about

https://cgc.darpa.mil/CGC_Rules_16_May_14_Version_2.pdf

Perhaps this will be a yearly contest.

There is a catch though, to collect the prizes: "The prize recipient shall 
be a citizen, a permanent resident of the United States, or a US Entity. "


Bye,
 Skybuck. 


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


ANN: SfePy 2015.3

2015-09-23 Thread Robert Cimrman

I am pleased to announce release 2015.3 of SfePy.

Description
---

SfePy (simple finite elements in Python) is a software for solving systems of
coupled partial differential equations by the finite element method or by the
isogeometric analysis (preliminary support). It is distributed under the new
BSD license.

Home page: http://sfepy.org
Mailing list: http://groups.google.com/group/sfepy-devel
Git (source) repository, issue tracker, wiki: http://github.com/sfepy

Highlights of this release
--

- preliminary support for parallel computing
- unified evaluation of basis functions (= isogeometric analysis fields can be
  evaluated in arbitrary points)
- (mostly) fixed finding of reference element coordinates of physical points
- several new or improved examples

For full release notes see http://docs.sfepy.org/doc/release_notes.html#id1
(rather long and technical).

Best regards,
Robert Cimrman on behalf of the SfePy development team

---

Contributors to this release in alphabetical order:

Robert Cimrman
Vladimir Lukes
--
https://mail.python.org/mailman/listinfo/python-announce-list

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


[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread Berker Peksag

Berker Peksag added the comment:

I like the new features, but I think we should take a look at issue 10967 
before converting it to a package or refactoring it.

The buildbot part is also a bit complicated. For example, support.verbose 
doesn't work correctly on builtbots: issue 23235.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka wrote:
"""
You can just mover parts of the code into utility files (or to the test.support 
package) without converting regrtest.py to a package. This preserves 
compatibility with running Lib/test/regrtest.py as a script.
"""

Does it really matter? Who runs directly Lib/test/regrtest.py? It's simple to 
replace Lib/test/regrtest.py with -m test (or -m test.regrtest), no?

Serhiy Storchaka wrote: "Global variables are not evil in a script. Are there 
other reasons besides 
aesthetic?"

It's much easier to split a long function using multiple small functions when 
no global variable is used. I also like OOP, so I created a class. Should I 
understand that you don't like classes and would prefer to keep flat functions?

Martin Panter wrote:
"I never used --single, but quickly looking at the code, it looks like the 
pynexttest file got stored in /tmp or similar, via tempfile.gettempdir(), so it 
should usually survive. However it looks like your patch now creates 
“pynexttest” in a temporary directory that gets removed at the end?"

Ah ok, it's /tmp. I misunderstood the code. I understand that it creates a 
temporary subdirectory and write into the temporary subdirectory which will be 
removed.

Berker Peksag: "I like the new features, but I think we should take a look at 
issue 10967 before converting it to a package or refactoring it."

Even if we move some features to unittest, I don't think that regrtest.py will 
be reduced to fewer than 100 lines of code. By the way, most reusable code is 
in test.support. test.regrtest is much more specific to the CPython test suite, 
no?

Berker Peksag: "The buildbot part is also a bit complicated. For example, 
support.verbose doesn't work correctly on builtbots: issue 23235."

Sorry, I don't see the link with this issue. How are these two issues related?

--

___
Python tracker 

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



Re: Cyber Grand Challenge, prizes up to 2 million dollars ! (DARPA)

2015-09-23 Thread Skybuck Flying

Also very interesting read:

https://cgc.darpa.mil/CGC_FAQ.pdf

Just the list of common programming mistakes is already pretty interesting ! 
;) =D


Bye,
 Skybuck.

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


[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread Martin Panter

Martin Panter added the comment:

I never used --single, but quickly looking at the code, it looks like the 
pynexttest file got stored in /tmp or similar, via tempfile.gettempdir(), so it 
should usually survive. However it looks like your patch now creates 
“pynexttest” in a temporary directory that gets removed at the end?

Left another comment on Rietveld about out of date stuff in __main__.

--
nosy: +martin.panter

___
Python tracker 

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



[issue25214] asyncio ssl transport regression

2015-09-23 Thread STINNER Victor

STINNER Victor added the comment:

> I've missed your patch, sorry.

There is no need to be sorry :-)

> Everything is fixed by http://bugs.python.org/issue25114

Wow, great :-)

Thanks again Mathieu Pasquet who reported the issue #22768.

--
status: open -> closed
superseder:  -> asyncio: add ssl_object extra info

___
Python tracker 

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



Re: Python, convert an integer into an index?

2015-09-23 Thread Denis McMahon
On Tue, 22 Sep 2015 14:43:55 -0700, Chris Roberts wrote:

> results = 134523  #(Integer)

This appears to be an integer expressed (presumably) in base 10 with 6 
digits

> Desired:
> results = [1, 2, 3, 4, 5, 2, 3]   #(INDEX)

This appears to be a python list of 7 elements, with the first and the 
the third through seventh elements corresponding to the first and the 
second through sixth most significant digits respectively of the 
previously discussed integer.

I can't actually see any direct method of creating the list given from 
the number given.

However, if I understand the intent of the question you meant to ask, you 
might find that the following code does something interesting:

x = 9876543210
y = []

while x > 0:
y.append(x % 10)
x = int(x / 10)

y = list(reversed(y))
print y

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread STINNER Victor

STINNER Victor added the comment:

Another recent example:

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/6712/steps/test/logs/stdio

...
[395/399] test_asyncio
[396/399] test_email
[397/399] test_threaded_import
[398/399] test_tools

command timed out: 3900 seconds without output, attempting to kill
program finished with exit code 1
elapsedTime=4958.515000

--

___
Python tracker 

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



Re: Readlines returns non ASCII character

2015-09-23 Thread Ian Kelly
On Wed, Sep 23, 2015 at 6:47 AM, SANKAR .  wrote:
> Hi all,
>
> I am not a expert programmer but I have to extract information from a large
> file.
>  I used  codecs.open(..) with UTF16 encoding to read this file. It could
> read all the lines in the file but returns with the non Ascii characters.
> Below are 5 sample lines. How do I avoid having this non Ascii items. Is
> there a better way to read this?

I suspect that what you want is not "non-ASCII" but just to read the
file without all the mojibake, which is likely an indication that
you're using the wrong encoding.

Do you know that UTF-16 is actually the encoding of the file?

Based on the spaces that appear between adjacent characters, I would
guess that this is probably in a 32-bit encoding, perhaps UTF-32. On
the other hand, the repeated 0x00ff 0x00fe 0x00ff are very curious; I
don't see how that could be valid UTF-32. Are you sure that this is a
text file and not some propietary binary data format?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python, convert an integer into an index?

2015-09-23 Thread Chris Roberts
Fantastic!
I started a course, but I have been having issues with
string/index/list/integer conversions and manipulations.
This variation wasn't in any of my texts or class exercises either.
Your way was both simple enough to understand and very informative!
Thanks.


On Tue, Sep 22, 2015 at 6:21 PM, Laura Creighton  wrote:

> In a message of Tue, 22 Sep 2015 14:43:55 -0700, Chris Roberts writes:
> >
> >
> >(How do I make it into an index? )
> >Preferably something fairly easy to understand as I am new at this.
> >
> >results = 134523  #(Integer)
> >
> >Desired:
> >results = [1, 2, 3, 4, 5, 2, 3]   #(INDEX)
> >
> >Somehow I see ways to convert index to list to int, but not back again.
> >
> >Thanks,
> >crzzy1
>
> You need to convert your results into a string first.
>
> result_int=1234523
> result_list=[]
>
> for digit in str(result_int):
> result_list.append(int(digit))
>
> digit will be assigned to successive 1 character long strings.  Since
> you wanted a list of integers, you have to convert it back.
>
> If you are learning python you may be interested in the tutor mailing
> list. https://mail.python.org/mailman/listinfo/tutor
>
> Laura
>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python, convert an integer into an index?

2015-09-23 Thread Tim Daneliuk
On 09/22/2015 04:43 PM, Chris Roberts wrote:
> 
> (How do I make it into an index? )
> Preferably something fairly easy to understand as I am new at this.
> 
> results = 134523  #(Integer) 
> 
> Desired: 
> results = [1, 2, 3, 4, 5, 2, 3]   #(INDEX)
> 
> Somehow I see ways to convert index to list to int, but not back again.
> 
> Thanks, 
> crzzy1
> 



results = [x for x in str(results)]
-- 
https://mail.python.org/mailman/listinfo/python-list


PyInstaller+ Python3.5 (h5py import error)

2015-09-23 Thread Heli Nix
Dear all, 

Thanks a lot for your replies. Very helpful. I have already done some trials 
with Virtualenv, but PyInstaller is much closer to the idea of an installer you 
can pass to someone. 

 I have been using development version of PyInstaller in order to be able to 
use it with my script written with Python versin 3.3.5. 

I started with a very simple script just to test. I use the following command 
to create the distribution folder. 

pyinstaller test.py

my script contains the following few lines and it runs ok on my own machine.

import numpy as np
import h5py

a=np.arange(10)
print(a)
inputFiles="test.h5"
with h5py.File(inputFiles, 'w') as inputFileOpen:
  pass

I am getting the following error related to importing h5py. 

test returned -1
Traceback (most recent call last):
  File "", line 2, in 
  File 
"/usr/lib/python3.3/site-packages/PyInstaller-3.0.dev2-py3.3.egg/PyInstaller/loader/pyimod03_importers.py",
 line 311, in load_module
  File "/usr/lib64/python3.3/site-packages/h5py/__init__.py", line 23, in 

  File 
"/usr/lib/python3.3/site-packages/PyInstaller-3.0.dev2-py3.3.egg/PyInstaller/loader/pyimod03_importers.py",
 line 493, in load_module
  File "h5r.pxd", line 21, in init h5py._conv 
(/tmp/pip_build_root/h5py/h5py/_conv.c:6563)
  File 
"/usr/lib/python3.3/site-packages/PyInstaller-3.0.dev2-py3.3.egg/PyInstaller/loader/pyimod03_importers.py",
 line 493, in load_module
  File "_objects.pxd", line 12, in init h5py.h5r 
(/tmp/pip_build_root/h5py/h5py/h5r.c:2708)
  File 
"/usr/lib/python3.3/site-packages/PyInstaller-3.0.dev2-py3.3.egg/PyInstaller/loader/pyimod03_importers.py",
 line 493, in load_module
  File "_objects.pyx", line 1, in init h5py._objects 
(/tmp/pip_build_root/h5py/h5py/_objects.c:6407)
ImportError: No module named 'h5py.defs'

If I modify my script to 

import numpy as np
import h5py
a=np.arange(10)
print(a)

 then, the created exectuable will run successfully on other linux machines.  
Does anybody have any idea why I am getting the following h5py import error?

My spec file also looks like this:

# -*- mode: python -*-

block_cipher = None


a = Analysis(['test.py'],
 pathex=['/home/albert/test'],
 binaries=None,
 datas=None,
 hiddenimports=[],
 hookspath=None,
 runtime_hooks=None,
 excludes=None,
 win_no_prefer_redirects=None,
 win_private_assemblies=None,
 cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
 cipher=block_cipher)
exe = EXE(pyz,
  a.scripts,
  exclude_binaries=True,
  name='test',
  debug=False,
  strip=None,
  upx=True,
  console=True )
coll = COLLECT(exe,
   a.binaries,
   a.zipfiles,
   a.datas,
   strip=None,
   upx=True,
   name='test')


Thank you very much in Advance for your help, 


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


Re: A little test for you Guys

2015-09-23 Thread alister
On Wed, 23 Sep 2015 00:56:19 +0100, MRAB wrote:

> On 2015-09-23 00:32, Mark Lawrence wrote:
>> On 22/09/2015 19:43, Python_Teacher via Python-list wrote:
>>> you have 10 minutes Good luck!!
>>>
>>>
>>> 1. What is PEP8 ?
>>
>> It's the one between PEP7 and PEP9.
>>
>>
>>> 2. What are the different ways to distribute some python source code ?
>>
>> Write on sheet of paper, fold into paper dart, throw from window.
>>
>>
>>> 2 Lists
>>
>> Tut, tut, tut.
>>
>>
>>> Let's define the function plural :
>>>
>>> def plural(words):
>>>  plurals = []
>>>  for word in words:
>>> plurals.append(word + 's')
>>>  return plurals
>>>
>>> for word in plural(['cabagge','owl','toy']):
>>>  print word
>>>
>>> Question : How could the code of the function plural be optimised?
>>
>> It is all ready optimised for programmer time so don't bother with it
>> unless there are unforeseen bugs.
>>
>>
>>> 3 Dictionaries
>>>
>>> Here are two dictionnaries :
>>>
>>> input = {
>>>  'foo1': 'bar1', 'chose': 'truc', 'foo2': 'bar2',
>>> }
>>> output = {
>>>  'bar1': 'foo1', 'truc': 'chose', 'bar2': 'foo2'
>>> }
>>>
>>> Question : Propose a function that returns output when you provide
>>> input ?
>>
>> def function():
>>   return input("Who cares?")
>>
> You have a couple of problems:
> 
> 1. 'input' is already bound to a dict.
> 
> 2. From question 2, it's clear that Python 2 is being used, so you
> should be using 'raw_input' instead.
> 
> [snip]

the question also shadows a builtin :-)



-- 
This is for all ill-treated fellows
Unborn and unbegot,
For them to read when they're in trouble
And I am not.
-- A. E. Housman
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyInstaller+ Python3.5 (h5py import error)

2015-09-23 Thread Christian Gollwitzer

Am 23.09.15 um 18:20 schrieb Heli Nix:

Dear all,

Thanks a lot for your replies. Very helpful. I have already done some trials 
with Virtualenv, but PyInstaller is much closer to the idea of an installer you 
can pass to someone.

  I have been using development version of PyInstaller in order to be able to 
use it with my script written with Python versin 3.3.5.

I started with a very simple script just to test. I use the following command 
to create the distribution folder.

pyinstaller test.py

my script contains the following few lines and it runs ok on my own machine.

import numpy as np
import h5py

a=np.arange(10)
print(a)
inputFiles="test.h5"
with h5py.File(inputFiles, 'w') as inputFileOpen:
   pass

I am getting the following error related to importing h5py.

[...]
ImportError: No module named 'h5py.defs'


pyinstaller guesses from the code which modules are imported. It looks 
like if h5py imports a module h5py.defs, which is missing. For some 
programs, you need to support pyinstaller with additional information, 
especially if modules are loaded at runtime. Try:



pyinstaller --hidden-import=h5py.defs test.py


If I modify my script to

import numpy as np
import h5py
a=np.arange(10)
print(a)


This is another hint: obviously h5py defers module loading until you 
first really open a HDF5 file. There pyinstaller has no means to find 
this out.


Christian

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


Re: List comprehensions and evaluation of elements therein

2015-09-23 Thread Ian Kelly
On Wed, Sep 23, 2015 at 12:12 PM, James Harris  wrote:
> A list comprehension has various components. Anyone know when each of the
> elements is evaluated? In the form
>
>  [v0 for v0 in expr0 if expr1]
>
> If v0 appears in expr0 or expr1 the evaluation order matters.
>
> I think of the above as being a rewrite of
>
>  results = []
>  for v0 in expr0:
>if expr1:
>  results.append(v0)
>  return results
>
> Further,
>
>  [v0, v2 for v0 in expr0 if expr1 for v2 in expr2 if expr3]
>
> leads to
>
>  results = []
>  for v0 in expr0:
> if expr1:
>for v2 in expr2:
>   if expr3:
>  results.append((v0, v2))
>  return results
>
> First of all, is that a correct analog of the list comprehension?

Looks right, see:
https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries

Note that the last sentence there about names not "leaking" is only
true for Python 3.

You may also be interested in PEPs 202 and 289.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25205] setattr accepts invalid identifiers

2015-09-23 Thread eryksun

eryksun added the comment:

Even MvL appears to slip up when he states "some may accept non-strings as 
attribute names". That would be pointless in a __setattr__ method since setattr 
/ PyObject_SetAttr reject non-string values as 'names'.

--

___
Python tracker 

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



[issue23329] _ssl cannot be compiled with LibreSSL anymore (on OpenBSD 5.5) because of ALPN

2015-09-23 Thread Remi Pointel

Remi Pointel added the comment:

With this patch it works fine on OpenBSD with LibreSSL.
Could you test on a Linux machine with OpenSSL supporting ALPN please?

Thanks spil@ for the idea.

--
keywords: +patch
Added file: http://bugs.python.org/file40556/python_have_alpn.diff

___
Python tracker 

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



[issue16701] Docs missing the behavior of += (in-place add) for lists.

2015-09-23 Thread R. David Murray

R. David Murray added the comment:

Wording looks ok...except that technically it is not that 'n' is an integer, 
it's that 'n' can play the role of an integer (ie: it has an __index__ method).

--

___
Python tracker 

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



[issue25210] Special-case NoneType() in do_richcompare()

2015-09-23 Thread R. David Murray

R. David Murray added the comment:

There are other places NoneType shows up (eg: attribute error).  Why should 
this case be special?  Do we want to fix them all?

--
nosy: +r.david.murray

___
Python tracker 

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



Video Tutorial Online On How To Create a Basic Dynamic Website In Python?

2015-09-23 Thread Cai Gengyang
Hello!

So I have Python 2.7.10, 3.3.2, 3.3.4 downloaded on my Mac OS X Yosemite 
10.10.2 and also downloaded pip and django. Is there an online tutorial on how 
to create a basic dynamic website in Python where I can put my 
image/photo/video sharing app ? I find it much easier to learn from something 
visual which I can follow step-by-step ...

Thanks a lot.

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


Sending a python argument to a Boost.Python function

2015-09-23 Thread kenseehart

I have a python class that wraps a boost.python object. I am using a 
boost.python library function that requires the raw boost.python object. I want 
to be able to pass the python object to the boost api function.

Is there a hook available on the python side that instructs boost to perform a 
conversion?

Hypothetically, it would be something like this:

class EggWrapper(object):
def __init__(self, egg):
object.__setattr__(self, '_egg', egg)

def __getattribute__(self, name):
egg = object.__getattribute__(self, '_egg')

if name=='_egg':
return egg

if name in EggWrapper.__dict__:
return object.__getattribute__(self, name)

return getattr(egg, name)

def __setattr__(self, name, value):
egg = object.__getattribute__(self, '_egg')
setattr(egg, name, value)

def magic_boost_conversion_unicorn_hook(self):
'this is automatically called by boost to convert arguments'
egg = object.__getattribute__(self, '_egg')
return egg


import myboostlib

egg = EggWrapper(myboostlib.getEgg())

myboostlib.spam(egg)


Where the signature for spam is: spam(class boost::python::api::object)
And myboostlib.getEgg() returns a boost::python::api::object

- I do not have the ability to modify the library or any C/C++ code, the 
solution must be entirely on the python side.

- I can't change the calling convention. The wrapped object must be used (i.e. 
I can't just say myboostlib.spam(egg._egg), though that is the desired result). 
So the solution should be incorporated into the EggWrapper class.

- I'm only interested in solutions that reflect expert knowledge of 
Boost.Python, since I believe I have already considered all the trivial 
solutions.

So my question is, does magic_boost_conversion_unicorn_hook() exist, and if so, 
how is it spelled?


Thanks,
~ Ken





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


Re: A little test for you Guys

2015-09-23 Thread Christian Gollwitzer

You've got a lot of sensible answers, but let me add to this one:

Am 22.09.15 um 20:43 schrieb Python_Teacher:

input = {
 'foo1': 'bar1',
 'chose': 'truc',
 'foo2': 'bar2',
}
output = {
 'bar1': 'foo1',
 'truc': 'chose',
 'bar2': 'foo2'
}


This one can be done as a dict comprehension:

>>> p = {'foo1': 'bar1', 'foo2': 'bar2', 'chose': 'truc'}

>>> { v:k for k,v in p.items()}
{'bar1': 'foo1', 'truc': 'chose', 'bar2': 'foo2'}

list/dict comprehension is actually one of the features in Python that I 
like most, because it can greatly ease such transformations.



and, as others said, these questions are lightyears apart from 
showing that somebody understands Python programming. They can be solved 
by trying it or googling, and that is what a real programmer would 
actually do if he is stuck.


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


[issue25219] Update doc for Idle command line argument.

2015-09-23 Thread Terry J. Reedy

New submission from Terry J. Reedy:

idle.rst is either wrong or obsolete.  Some options are missing and the notes 
are not now correct.  I am editing so it matches code and help message in 
PyShell.py.

I believe there is a mismatch between code and help message with respect to 
interaction with configuration settings.  But I need to do some tests to be 
sure.

--
messages: 251407
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Update doc for Idle command line argument.
type: behavior
versions: Python 2.7, 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



Re: Postscript to pdf

2015-09-23 Thread Christian Gollwitzer

Am 21.09.15 um 17:20 schrieb Baladjy KICHENASSAMY:

Hello,
This is my programe : on mac i was able to output ps file but i didn't
got the pdf file :/


Maybe ps2pdf is not installed? I think it doesn't come with the Mac. You 
need to get it via fink, homebrew, macports or an official ghostscript 
binary. The same holds true for convert, which is a tool from ImageMagick.


Yet another option would be to wrap the pdf4tcl library:

http://sourceforge.net/projects/pdf4tcl/

It can create PDF from a canvas without an external dependency. The Tcl 
code for it looks like this:



package require pdf4tcl
set size [list [winfo width $win] [winfo height $win]]
set pdf [pdf4tcl::new %AUTO% -paper $size -compress false]
$pdf canvas $win
$pdf write -file $fn
$pdf destroy


In principle, you could run this code via Tkinter.eval()
You would need to set "win" to your canvas path and "fn" to the file 
name path.


Yet another option would be to use a Python package like Reportlab to 
create the PDFs, which requires you to reimplement the drawing code.


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


[issue22052] Comparison operators called in reverse order for subclasses with no override.

2015-09-23 Thread Mark Dickinson

Mark Dickinson added the comment:

> the most we should do is document the behaviour somewhere

And indeed, perhaps this issue counts as sufficient documentation...

--

___
Python tracker 

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




[issue25117] Windows installer: precompiling stdlib fails with missing DLL errors

2015-09-23 Thread Marius Gedminas

Marius Gedminas added the comment:

For the record, I rebooted once, after installing both 32-bit and 64-bit 
versions of Python 3.5.

(Also, it seems that the Python 3.5 installer didn't install pip for me, which 
could be fallout from this bug?  I had to run python -m ensurepip to get it.)

--

___
Python tracker 

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



Re: sort help

2015-09-23 Thread Peter Otten
Larry Martell wrote:

> I currently have 3 lists of lists and I sort them based on a common
> field into a single list like this:
> 
> def GetObjKey(a):
> return a[2]
> 
> sorted(a + b + c, key=GetObjKey)
> 
> Which works just fine.
> 
> But now, I need to have just the first list (a) also sub sorted by
> another field and I can't quite figure out how to do this.
> 
> So for example, if my initial data was this (I'll only show the fields
> involved with the sort - the first number is a[2] above and the second
> is the new additional sorting field, only present in a)
> 
> a[1, 4]
> a[1, 2]
> a[2, 3]
> a[2, 1]
> a[5, 6]
> a[5, 2]
> b[2]
> b[5]
> c[1]
> c[6]
> 
> Then I'd want my sorted list to be this:
> 
> a[1,2]
> a[1,4]
> c[1]
> a[2,1]
> a[2,3]
> b[2]
> a[5,2]
> a[5,6]
> b[5]
> c[6]
> 
> I hope that's clear.
> 
> So is there some pythonic way to sort this without resorting to a
> brute force old fashioned plow through the data?

Performing two sorts as suggested by Chris and Paul is cleaner, but it is 
possible to write the key function you were probably looking for.

def get_obj_key(a):
if has_extra_field(a):
return a[2], 0, a[-1] # assuming a[-1] is the extra field
else:
return a[2], 1

You have to write the has_extra_field() test yourself as I don't know what 
distinguishes the items in a from those in the other sequences. For example:

>>> a = [[1, 4], [1, 2], [2, 3], [2, 1], [5, 6], [5, 2]]
>>> b = [[2], [5]]
>>> c = [[1], [6]]
>>> sorted(a + b + c,
... key=lambda a: (a[0], 0, a[-1]) if len(a) > 1 else (a[0], 1))
[[1, 2], [1, 4], [1], [2, 1], [2, 3], [2], [5, 2], [5, 6], [5], [6]]


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


[issue12067] Doc: remove errors about mixed-type comparisons.

2015-09-23 Thread Martin Panter

Martin Panter added the comment:

I committed the changes to expressions.rst for 3.4+. That still leaves the 
changes to test_compare.py, and possibly changes for 2.7.

Andy: In msg229721 you mentioned a potential 2.7 patch. Did you get anywhere 
with that? Even if it is only half finished, someone else may be able to keep 
working on it.

--

___
Python tracker 

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



[issue23329] _ssl cannot be compiled with LibreSSL anymore (on OpenBSD 5.5) because of ALPN

2015-09-23 Thread Bernard Spil

Bernard Spil added the comment:

Checking if the method is actually defined is the smart way to go

>From include/openssl/tls1.h
# define TLSEXT_TYPE_application_layer_protocol_negotiation

So #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
would show you if the feature is available regardless of the implementation 
(Open|Boring|Libre)SSL

--

___
Python tracker 

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



[issue25198] Idle: improve idle.html help viewer.

2015-09-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

List indent glitch: In the command line section, after the box, idle.rst has 

If there are arguments:

#. If ``-``, ``-c``, or ``r`` is used, all arguments are placed in
   ``sys.argv[1:...]`` and ``sys.argv[0]`` is set to ``''``, ``'-c'``,
   or ``'-r'``.  No editor window is opened, even if that is the default
   set in the Options dialog.

Firefox shows this as (but does not allow copying of '1. ')

If there are arguments:

1. If -, -c, or r is used, all arguments are placed in sys.argv[1:...] and 
sys.argv[0] is set to '', '-c', or '-r'. No editor window is opened, even if 
that is the default set in the Options dialog.

The help window shows this, for example, (but not copy indent) as

If there are arguments: 

  * If -, -c, or r is used, all arguments are placed in sys.argv[1:...] and 
sys.argv[0] is set to
'', '-c', or '-r'.  No editor window is opened, even if that is the default set 
in the Options dialog.

The point is not '1. ' versus '* ', this being the only place where idle.rst 
uses '#' for a list (and I changed this).  The problem is the dedent of the 
second line.  This only occurs if the second line starts with a font change.  
If I narrow the window so it begins with 'to', the line is indented properly. 
Narrow further so it begins with 'sys', no ident. I am pretty sure I have not 
touched your indent code.  Any ideas on how to fix?  or a tk glitch?

--

___
Python tracker 

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



[issue22052] Comparison operators called in reverse order for subclasses with no override.

2015-09-23 Thread Mark Dickinson

Mark Dickinson added the comment:

For Python 2, I think the most we should do is document the behaviour 
somewhere; changing it in a bugfix release seems both unnecessary and 
potentially risky.

--

___
Python tracker 

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



Re: Python, convert an integer into an index?

2015-09-23 Thread marco . nawijn
On Wednesday, September 23, 2015 at 1:27:51 AM UTC+2, MRAB wrote:
> On 2015-09-22 23:21, Laura Creighton wrote:
> > In a message of Tue, 22 Sep 2015 14:43:55 -0700, Chris Roberts writes:
> >>
> >>
> >>(How do I make it into an index? )
> >>Preferably something fairly easy to understand as I am new at this.
> >>
> >>results = 134523  #(Integer)
> >>
> >>Desired:
> >>results = [1, 2, 3, 4, 5, 2, 3]   #(INDEX)
> >>
> >>Somehow I see ways to convert index to list to int, but not back again.
> >>
> >>Thanks,
> >>crzzy1
> >
> > You need to convert your results into a string first.
> >
> > result_int=1234523
> > result_list=[]
> >
> > for digit in str(result_int):
> >  result_list.append(int(digit))
> >
> > digit will be assigned to successive 1 character long strings.  Since
> > you wanted a list of integers, you have to convert it back.
> >
> > If you are learning python you may be interested in the tutor mailing
> > list. https://mail.python.org/mailman/listinfo/tutor
> >
> A shorter way using strings:
> 
> >>> results = 134523
> >>> list(map(int, str(results)))
> [1, 3, 4, 5, 2, 3]
Or you can use a list comprehension:

>>> result = [int(c) for c in str(134523)]
>>> print result
[1, 3, 4, 5, 2, 3]
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: pySerial 3.0a0

2015-09-23 Thread Chris Liechti

A new prerelease of pySerial is available. There have been a lot
of changes so that the major version was bumped up to 3.

Changes include:
- Python 2.7 and Python 3.2+ from the same sources (lib2to3 is
  no longer used)
- More properties, the set functions are deprecated.
- Updated miniterm (uses Unicode for console output, supports
  encodings on serial port, nicer port selection and more).
- IPv6 support for rfc2217:// and socket://
- New spy:// handler to log traffic and control calls.
- URL parameters have changed.
- Experimental asyncio support (posix)
- A number of other bugfixes.
- And more...

See https://github.com/pyserial/pyserial/blob/master/CHANGES.rst
for more details.

Changes in development:
- SVN -> GIT
- moved (from SF) to github: https://github.com/pyserial/pyserial

Currently unsupported is the Jython platform (lack of testing).

Download at: https://github.com/pyserial/pyserial/releases
Docs: https://pyserial.readthedocs.org/en/latest/

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

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


[issue19143] Finding the Windows version getting messier (detect windows 8.1?)

2015-09-23 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 23.09.2015 02:33, Steve Dower wrote:
> 
> Done.

Thanks.

> As this is (meant to be) a purely informational/diagnostic module, seems like 
> a good idea to fix every version we're supporting in any way.

Yep, that's the intention behind the platform module.

--

___
Python tracker 

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



[issue25148] Windows registry PythonCore key changed inconsistent with other releases

2015-09-23 Thread Barry Scott

Barry Scott added the comment:

To clarify:

3.5 means 3.5 64 bit
3.5-32 means 3.5 32 bit

You do not add the -64 as it is the default.

However: this change should have been in the "What's New" as it breaks Windows 
installation code for extensions.

--

___
Python tracker 

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



[issue1401] urllib2 302 POST

2015-09-23 Thread RuixiaZhang

RuixiaZhang added the comment:

I am using  python 2.7,the same ,come to 302 lost cookies,
I try add the code :
req.headers.pop('content-length')
to urllib2.py:536
but, have another error:
KeyError: 'content-length'
So, I want to ask is there any better method to solver this error?

--
components: +Windows -XML
nosy: +paul.moore, steve.dower, tim.golden, zach.ware, zhangruixia0108
versions: +Python 2.7 -Python 2.5

___
Python tracker 

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



Re: Successfully send sms with python

2015-09-23 Thread Pavel S
I don't understand why all of you are telling him about '\r\n\, write(),..' 
instead of recommending to use take library which already has all problems 
resolved (python-gammu / wammu).

When one will write custom templating stuff, you would also recommend him to 
take jinja.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18967] Find a less conflict prone approach to Misc/NEWS

2015-09-23 Thread Larry Hastings

Larry Hastings added the comment:

Okay.  I got tired of the constant Misc/NEWS merge conflicts, so I wrote a tool 
to fix the problem.  It's checked in to Bitbucket here:

https://bitbucket.org/larry/mergenews/

There's a readme, which you'll see rendered on that page.

I don't know what you mean by "attach Misc/NEWS entries to the issue tracker".  
I figure, the Misc/NEWS entry is used as the checkin comment, so Roundup Robot 
already adds it for you, so maybe that's good enough.

Can we maybe switch to this for 3.6?  Should we consider switching all 3.x 
branches under active development to use this approach?

--

___
Python tracker 

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



[issue25219] Update doc for Idle command line options.

2015-09-23 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
title: Update doc for Idle command line arguments. -> Update doc for Idle 
command line options.

___
Python tracker 

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



ANN: eGenix mxODBC Connect 2.1.4 - Remote Python Database Interface

2015-09-23 Thread eGenix Team: M.-A. Lemburg


ANNOUNCING

  eGenix.com mxODBC Connect

  Remote Python Database Interface

Version 2.1.4


 mxODBC Connect is our commercially supported client-server product for
   connecting Python applications to relational databases
 in a truly platform independent way.


This announcement is also available on our website for online reading:
http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.1.4-GA.html



INTRODUCTION

The mxODBC Connect Database Interface for Python allows users to
easily connect Python applications to all major databases on the
market today in a highly portable, convenient and secure way.

Python Database Connectivity the Easy Way
-

Building on our mxODBC database interface for Python, mxODBC Connect
is designed as client-server application, so you no longer need to
find production quality database drivers for all platforms you target
with your Python application.

Instead, you use an easy to install royalty-free Python client library
which connects directly to the mxODBC Connect database server over the
network.

This makes mxODBC Connect a great basis for writing cross-platform
multi-tier database applications and utilities in Python, especially
if you run applications that need to communicate with databases such
as MS SQL Server and MS Access, Oracle Database, IBM DB2 and Informix,
Sybase ASE and Sybase Anywhere, MySQL, PostgreSQL, SAP MaxDB and many
more, that run on Windows or Linux machines.

Ideal for Database Driven Client Applications
-

By removing the need to install and configure ODBC drivers on the
client side and dealing with complicated network setups for each set
of drivers, mxODBC Connect greatly simplifies deployment of database
driven client applications, while at the same time making the network
communication between client and database server more efficient and
more secure.

For more information, please have a look at the mxODBC Connect product
page, in particular, the full list of available features.

For more information, please see the product page:

http://www.egenix.com/products/python/mxODBCConnect/



NEWS

mxODBC Connect 2.1.4 is a patch level release of our successful mxODBC
Connect database product. It includes these enhancements and fixes:

Security Enhancements
-

 * Updated included OpenSSL libraries to 1.0.1p. Please see the
   egenix-pyopenssl change log for a complete list of changes. Among
   other security fixes, this addresses the Logjam attack.

   http://www.egenix.com/products/python/pyOpenSSL/changelog.html

mxODBC Connect Enhancements
---

 * Added support for the BinaryNull work-around added to mxODBC 3.3.5
   in order to better support VARBINARY columns in MS SQL Server.

   Both mxODBC Connect Client and Server will need to upgraded to
   version 2.1.4 in order to be able to use the new singleton.

 * The mxODBC Connect Client can now be compiled to a wheel file to
   simplify deployment. Simply point the pip at the prebuilt archive.

mxODBC API Enhancements
---

 * Upgraded the mxODBC Connect Server to mxODBC 3.3.5:

   http://www.egenix.com/company/news/eGenix-mxODBC-3.3.5-GA.html

MS SQL Server
-

 * Documented and recommended use of SET NOCOUNT ON for running
   multiple statements or stored procedures. This can not only resolve
   issues with error reporting, it also results in better performance.

 * Added a work-around for MS SQL Server Native Client to be able to
   support VARCHAR/VARBINARY(MAX) columns when using the Native Client
   with direct execution mode or Python type binding mode. Thanks to
   ZeOmega for reporting this.

 * Added new helper singleton BinaryNull to allow binding a NULL to a
   VARBINARY column with SQL Server in direct execution mode or Python
   type binding mode (as used for FreeTDS). Using the usual None
   doesn't work in those cases, since SQL Server does not accept a
   VARCHAR data type as input for VARBINARY, except by using an
   explicit "CAST(? AS VARBINARY)". mxODBC binds None as VARCHAR for
   best compatibility, when not getting any type hints from the ODBC
   driver.

 * Added a fix for the MS SQL Server Native Client error
   "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]The data
   types varchar and text are incompatible in the equal to operator."
   when trying to bind a string of more than 256 bytes to a VARCHAR
   column while using cursor.executedirect(). cursor.execute() was
   unaffected by this. Thanks to Paul Perez for reporting this.

 * Added a note to avoid using "execute " when calling stored
   procedures with 

[issue25219] Update doc for Idle command line arguments.

2015-09-23 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
assignee:  -> terry.reedy

___
Python tracker 

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



[issue25219] Update doc for Idle command line arguments.

2015-09-23 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
title: Update doc for Idle command line argument. -> Update doc for Idle 
command line arguments.

___
Python tracker 

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



[issue25219] Update doc for Idle command line argument.

2015-09-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 80e92eba23e0 by Terry Jan Reedy in branch '2.7':
Issue #25219: Update doc for Idle command line options.
https://hg.python.org/cpython/rev/80e92eba23e0

New changeset 97f3d7749d3f by Terry Jan Reedy in branch '3.4':
Issue #25219: Update doc for Idle command line options.
https://hg.python.org/cpython/rev/97f3d7749d3f

--
nosy: +python-dev

___
Python tracker 

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



[issue9928] weird oddity with bz2 context manager

2015-09-23 Thread Roman Valls

Roman Valls added the comment:

It still seems to be failing with Python 2.7.10... or am I doing sth wrong? :/


$ ipython
Python 2.7.10 |Anaconda 2.2.0 (x86_64)| (default, May 28 2015, 17:04:42)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import bz2
In [2]: import pandas as pd
In [3]: import numpy as np
In [4]: import matplotlib as plt
In [5]: import seaborn as sns
In [6]: import cPickle as pickle

In [7]: with open("./collectl_info.pickle.bz2", "rb") as comp:
   ...: with bz2.decompress(comp.read()) as decomp:
   ...: data, hardware, steps = pickle.load(decomp)
   ...:

---
AttributeErrorTraceback (most recent call last)
 in ()
  1 with open("./collectl_info.pickle.bz2", "rb") as comp:
> 2 with bz2.decompress(comp.read()) as decomp:
  3 data, hardware, steps = pickle.load(decomp)
  4

AttributeError: __exit__

--
nosy: +Roman Valls
versions:  -Python 3.1, Python 3.2

___
Python tracker 

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



ANN: eGenix mxODBC Connect 2.1.4 - Remote Python Database Interface

2015-09-23 Thread eGenix Team: M.-A. Lemburg


ANNOUNCING

  eGenix.com mxODBC Connect

  Remote Python Database Interface

Version 2.1.4


 mxODBC Connect is our commercially supported client-server product for
   connecting Python applications to relational databases
 in a truly platform independent way.


This announcement is also available on our website for online reading:
http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.1.4-GA.html



INTRODUCTION

The mxODBC Connect Database Interface for Python allows users to
easily connect Python applications to all major databases on the
market today in a highly portable, convenient and secure way.

Python Database Connectivity the Easy Way
-

Building on our mxODBC database interface for Python, mxODBC Connect
is designed as client-server application, so you no longer need to
find production quality database drivers for all platforms you target
with your Python application.

Instead, you use an easy to install royalty-free Python client library
which connects directly to the mxODBC Connect database server over the
network.

This makes mxODBC Connect a great basis for writing cross-platform
multi-tier database applications and utilities in Python, especially
if you run applications that need to communicate with databases such
as MS SQL Server and MS Access, Oracle Database, IBM DB2 and Informix,
Sybase ASE and Sybase Anywhere, MySQL, PostgreSQL, SAP MaxDB and many
more, that run on Windows or Linux machines.

Ideal for Database Driven Client Applications
-

By removing the need to install and configure ODBC drivers on the
client side and dealing with complicated network setups for each set
of drivers, mxODBC Connect greatly simplifies deployment of database
driven client applications, while at the same time making the network
communication between client and database server more efficient and
more secure.

For more information, please have a look at the mxODBC Connect product
page, in particular, the full list of available features.

For more information, please see the product page:

http://www.egenix.com/products/python/mxODBCConnect/



NEWS

mxODBC Connect 2.1.4 is a patch level release of our successful mxODBC
Connect database product. It includes these enhancements and fixes:

Security Enhancements
-

 * Updated included OpenSSL libraries to 1.0.1p. Please see the
   egenix-pyopenssl change log for a complete list of changes. Among
   other security fixes, this addresses the Logjam attack.

   http://www.egenix.com/products/python/pyOpenSSL/changelog.html

mxODBC Connect Enhancements
---

 * Added support for the BinaryNull work-around added to mxODBC 3.3.5
   in order to better support VARBINARY columns in MS SQL Server.

   Both mxODBC Connect Client and Server will need to upgraded to
   version 2.1.4 in order to be able to use the new singleton.

 * The mxODBC Connect Client can now be compiled to a wheel file to
   simplify deployment. Simply point the pip at the prebuilt archive.

mxODBC API Enhancements
---

 * Upgraded the mxODBC Connect Server to mxODBC 3.3.5:

   http://www.egenix.com/company/news/eGenix-mxODBC-3.3.5-GA.html

MS SQL Server
-

 * Documented and recommended use of SET NOCOUNT ON for running
   multiple statements or stored procedures. This can not only resolve
   issues with error reporting, it also results in better performance.

 * Added a work-around for MS SQL Server Native Client to be able to
   support VARCHAR/VARBINARY(MAX) columns when using the Native Client
   with direct execution mode or Python type binding mode. Thanks to
   ZeOmega for reporting this.

 * Added new helper singleton BinaryNull to allow binding a NULL to a
   VARBINARY column with SQL Server in direct execution mode or Python
   type binding mode (as used for FreeTDS). Using the usual None
   doesn't work in those cases, since SQL Server does not accept a
   VARCHAR data type as input for VARBINARY, except by using an
   explicit "CAST(? AS VARBINARY)". mxODBC binds None as VARCHAR for
   best compatibility, when not getting any type hints from the ODBC
   driver.

 * Added a fix for the MS SQL Server Native Client error
   "[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]The data
   types varchar and text are incompatible in the equal to operator."
   when trying to bind a string of more than 256 bytes to a VARCHAR
   column while using cursor.executedirect(). cursor.execute() was
   unaffected by this. Thanks to Paul Perez for reporting this.

 * Added a note to avoid using "execute " when calling stored
   procedures with 

64bit Python builds on HP-UX ia64 and PA-RISC (Using GCC)

2015-09-23 Thread James Matthews
Hi,

I'm having some issues getting 64bit Python builds on HP-UX. I'm using the
GCC version available from the HP website. I've also tried using HP's
compiler but don't have much success either, even following the readme.
These are the results I get:

PA-RISC:

./configure CC=/opt/hp-gcc64-4.7.1/bin/gcc
make

Traceback (most recent call last):
  File "./setup.py", line 2240, in 
main()
  File "./setup.py", line 2235, in main
'Lib/smtpd.py']
  File "/tmp/jxm/Python-2.7.10/Lib/distutils/core.py", line 151, in setup
dist.run_commands()
  File "/tmp/jxm/Python-2.7.10/Lib/distutils/dist.py", line 953, in
run_commands
self.run_command(cmd)
  File "/tmp/jxm/Python-2.7.10/Lib/distutils/dist.py", line 972, in
run_command
cmd_obj.run()
  File "/tmp/jxm/Python-2.7.10/Lib/distutils/command/build.py", line 127,
in run
self.run_command(cmd_name)
  File "/tmp/jxm/Python-2.7.10/Lib/distutils/cmd.py", line 326, in
run_command
self.distribution.run_command(command)
  File "/tmp/jxm/Python-2.7.10/Lib/distutils/dist.py", line 972, in
run_command
cmd_obj.run()
  File "/tmp/jxm/Python-2.7.10/Lib/distutils/command/build_ext.py", line
337, in run
self.build_extensions()
  File "./setup.py", line 251, in build_extensions
build_ext.build_extensions(self)
  File "/tmp/jxm/Python-2.7.10/Lib/distutils/command/build_ext.py", line
446, in build_extensions
self.build_extension(ext)
  File "./setup.py", line 287, in build_extension
if not self.configure_ctypes(ext):
  File "./setup.py", line 2041, in configure_ctypes
exec f in fficonfig
  File "build/temp.hp-ux-B.11.31-9000-800-2.7/libffi/fficonfig.py", line
33, in 
ffi_sources += ffi_platforms['PA64_HPUX']
KeyError: 'PA64_HPUX'
*** Error exit code 1

During make I also get lots of errors like this: ./pyconfig.h:1188:0:
warning: "_POSIX_C_SOURCE" redefined [enabled by default]


ia64:

./configure CC=/opt/hp-gcc-4.7.1/bin/gcc CFLAGS="-mlp64"
Make

./pyconfig.h:1188:0: warning: "_POSIX_C_SOURCE" redefined [enabled by
default]
:0:0: note: this is the location of the previous definition
/opt/hp-gcc-4.7.1/bin/gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes  Parser/acceler.o  Parser/grammar1.o
Parser/listnode.o  Parser/node.o  Parser/parser.o  Parser/parsetok.o
Parser/bitset.o  Parser/metagrammar.o  Parser/firstsets.o
Parser/grammar.o  Parser/pgen.o Objects/obmalloc.o  Python/mysnprintf.o
Python/pyctype.o  Parser/tokenizer_pgen.o  Parser/printgrammar.o
Parser/pgenmain.o -lnsl -lrt -ldld -ldl  -o Parser/pgen
ld: Mismatched Data ABI. Expected None but found EF_IA_64_ABI64 in file
Parser/acceler.o
Fatal error.
collect2: error: ld returned 1 exit status
*** Error exit code 1
Stop.
*** Error exit code 1

Seems to be a library mismatch?

Any help would be appreciated.

Regards,
James
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25154] Drop the pyvenv script

2015-09-23 Thread Brett Cannon

Brett Cannon added the comment:

python-dev did not seem to object to the idea.

--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread R. David Murray

R. David Murray added the comment:

Victor and I have been discussing this on IRC.  We agreed that importing from 
regrtest and running regrtest as a script needs to keep working.

Summary of my disagreements: I'm leery of wholesale changes to regrtest
because we have gotten bug reports when we've broken things before.  Obviously 
it's not in the same problem-class as breaking Python, but I'd rather see us 
start a new command that drops the cruft and just does the things we really 
use, and stop maintaining regrtest.  However, I'm not in a position to do that 
work, and Victor has no interest in it.  So, I'm -0.5 on a big refactoring of 
regrtest (but have no objection to the new features :).  I won't block the 
change, I'd just prefer a cleaner solution...but don't have the time to 
implement it myself.

--

___
Python tracker 

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



[issue25224] Replace Idle's README.txt with annotated file list

2015-09-23 Thread Terry J. Reedy

New submission from Terry J. Reedy:

idlelib currently has user information that belongs in either the Idle 
reference idle.rst or possibly a separate Idle howto #17583. This information 
should be removed and replaced with an annotated list of files in idlelib.  The 
latter would help people working of Idle, and even people just browsing.

--
assignee: terry.reedy
components: IDLE
messages: 251464
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Replace Idle's README.txt with annotated file list
type: enhancement
versions: Python 2.7, 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



[issue24894] iso-8859-11 missing from codecs table

2015-09-23 Thread STINNER Victor

STINNER Victor added the comment:

Issue24894.patch is wrong: latin is an alias to ISO 8859-1, not to ISO 8859-11.

>>> codecs.lookup('latin').name
'iso8859-1'

iso8859_11 has 3 aliases: thai, iso_8859_11, iso_8859_11_2001. You can mention 
iso-8859-11 and thai in the doc.

--

___
Python tracker 

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



[issue25222] 3.5.0 regression - Fatal Python error: Cannot recover from stack overflow

2015-09-23 Thread Bernie Hackett

Bernie Hackett added the comment:

> Well, Python has no perfect protection again stack overflow. It's only best 
> effect.

That's interesting. I thought there was a stronger contract, and it appeared 
that way in all previous cpython releases back to 2.4. Again, this failure is 
new with 3.5.0.

> You should change sys.setrecursionlimit() to a lower limit to try to limit 
> the risk of a crash.

That's a great suggestion and it appears to work around the issue, thanks.

Feel free to close this won't fix, but given that this appears to be the second 
report of this issue for 3.5 (see issue22971) someone who understands 
interpreter internals may want to look into the problem a bit more first.

--

___
Python tracker 

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



List comprehensions and evaluation of elements therein

2015-09-23 Thread James Harris
A list comprehension has various components. Anyone know when each of 
the elements is evaluated? In the form


 [v0 for v0 in expr0 if expr1]

If v0 appears in expr0 or expr1 the evaluation order matters.

I think of the above as being a rewrite of

 results = []
 for v0 in expr0:
   if expr1:
 results.append(v0)
 return results

Further,

 [v0, v2 for v0 in expr0 if expr1 for v2 in expr2 if expr3]

leads to

 results = []
 for v0 in expr0:
if expr1:
   for v2 in expr2:
  if expr3:
 results.append((v0, v2))
 return results

First of all, is that a correct analog of the list comprehension?

With this latter expansion the values of v0 and v2 could appear in expr4 
or expr5. Again, the evaluation order would matter.


James

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


[issue25210] Special-case NoneType() in do_richcompare()

2015-09-23 Thread R. David Murray

R. David Murray added the comment:

I was agreeing with you, I think the comment should just be dropped.  My point 
was the alternative is really to change it everywhere, not just here :)

--

___
Python tracker 

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



[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c92d893fd3c8 by Victor Stinner in branch 'default':
Issue #25220: Backed out changeset eaf9a99b6bb8
https://hg.python.org/cpython/rev/c92d893fd3c8

--

___
Python tracker 

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



[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread STINNER Victor

STINNER Victor added the comment:

I pushed the changeset eaf9a99b6bb8, but R. David Murray asked me to wait for a 
review before pushing changes. So I reverted my change.

I checked if Lib/test/regrtest.py is called directly. The answer is yes: it's 
called inside Python in various places, but also in scripts to build Python 
packages. Even if "python -m test" works (and "python -m test.regrtest" works 
on all Python versions), I prefer to keep Lib/test/regrest.py to not force 
users to have to modify their script.

So I propose to simply move regrtest.py code to smaller files in 
Lib/test/libregrtest/, as I did in attached regrtest_package.patch.

In the changeset eaf9a99b6bb8, I started with cmdline.py because it's the only 
part of regrtest.py which has real unit tests. I created 
Lib/test/libregrtest/cmdline.py with "hg cp" to keep Mercurial history. I 
checked which moved symbols are used: _parse_args() and RESOURCE_NAMES. I 
exported them in test.libregrtest. I had to modify Lib/test/test_regrtest.py.

For next changes, I will try to add a few new unit tests to 
Lib/test/test_regrtest.py.

--

Berker wrote: "I like the new features, but I think we should take a look at 
issue 10967 before converting it to a package or refactoring it."

IMHO it will be easier to enhance regrtest to reuse unit test features, make 
the code smaller, fix bugs, etc. if regrtest.py is splitted into smaller files. 
Moving code to a new test.libregrtest submodule should help to implement the 
issue #10967 & friends (ex: #16748)

--

___
Python tracker 

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



[issue13253] 2to3 fix_renames renames sys.maxint only in imports

2015-09-23 Thread Nikita Klimov

Nikita Klimov added the comment:

I'm close to solution, but I need another 1 week.

--

___
Python tracker 

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



[issue25222] 3.5.0 regression - Fatal Python error: Cannot recover from stack overflow

2015-09-23 Thread STINNER Victor

STINNER Victor added the comment:

I'm not sure that I understood the bug.

You are testing a function which enters an unlimited loop. You expect to get a 
RecursionError, but Python does crash.

Well, Python has no perfect protection again stack overflow. It's only best 
effect. You should change sys.setrecursionlimit() to a lower limit to try to 
limit the risk of a crash.

It's hard to predict how the stack will be used.

FYI the error message comes from Python/ceval.c:

if (tstate->overflowed) {
if (tstate->recursion_depth > recursion_limit + 50) {
/* Overflowing while handling an overflow. Give up. */
Py_FatalError("Cannot recover from stack overflow.");
}
return 0;
}

I suggest you to use sys.setrecursionlimit() in your test, or remove the test.

Maybe there is a real bug, but if it's the case, it will probably be hard to 
investigate it. You need to dig into gdb.

--

___
Python tracker 

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



[issue25223] Statically or dynamically linked to the VC++runtime ? or how Python install fails o Vista despite the VC redist packages - api-ms-win-crt-runtime-l1-1-0.dll

2015-09-23 Thread acx01bc

New submission from acx01bc:

I think you should build Python.exe with the option to be statically linked to 
the VC++-runtime. This way, the executable is a little bigger, but you ensure 
nobody will have troubles with some VC-runtime different Dll versions.

DETAILS : (I posted it also there 
http://stackoverflow.com/questions/32748932/python-3-4-3-works-on-windows-vista-but-not-3-5-0-because-of-vc-redist-package
 )

I am on Windows Vista 32bits. I downloaded Python 3.5.0 but I got the famous 
api-ms-win-crt-runtime-l1-1-0.dll problem. Then I installed many Visual C++ 
Redistributable Packages (I tried the 2015's one, then 2013, and 2012) but none 
of these packages installed any .dll of the correct name. Then, I tried to 
download a previous version of Python, the 3.3.2 win32 release, I got the same 
problem !

> Then, I downloaded the Python 3.4.3 Win32 release, and this-one worked 
immediately. I suspect that version to have been statically linked with the 
VC-runtime. This clearly lacks of coherence, some Python releases work, while 
others don't. So I hope some of the Python developers will see that message and 
will be able to build some binaries compatible with Windows Vista and the 
VC-redist-packages.

Question : did anyone understand where that api-ms-win-crt-runtime-l1-1-0.dll 
comes from ? I suppose it is related to the VC++ compiler options used when 
building Python.exe (on my VS2010 I have the options code generation/runtime 
library/multi-threaded, static or dynamic and general/platform_toolset, V100, 
V110, V120 or V140) ?

--
components: Installation
messages: 251463
nosy: acx01bc
priority: normal
severity: normal
status: open
title: Statically or dynamically linked  to the VC++runtime ? or how Python 
install fails o Vista despite the VC redist packages - 
api-ms-win-crt-runtime-l1-1-0.dll
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



Re: Readlines returns non ASCII character

2015-09-23 Thread Ian Kelly
On Wed, Sep 23, 2015 at 3:02 PM, SANKAR .  wrote:
> Thanks Ian,
> this isn't a text file, but when I read with  readline I get the data I need
> along with mojibake. UTF 32 returns following error:
>
> Traceback (most recent call last):
>   File "D:\RV\RV1.py", line 17, in 
> linenumx1 = file.readlines()
>   File "C:\Python27\lib\codecs.py", line 682, in readlines
> return self.reader.readlines(sizehint)
>   File "C:\Python27\lib\codecs.py", line 591, in readlines
> data = self.read()
>   File "C:\Python27\lib\codecs.py", line 480, in read
> newchars, decodedbytes = self.decode(data, self.errors)
>   File "C:\Python27\lib\encodings\utf_32.py", line 130, in decode
> codecs.utf_32_ex_decode(input, errors, 0, False)
> UnicodeDecodeError: 'utf32' codec can't decode bytes in position 0-3: code
> point not in range(0x11)

1) Open the file in binary mode using the open function, not using codecs.open.
2) Find out or figure out the file format.
3) Read the file and extract the particular fields that you're
interested in from the file as bytes objects.
4) Decode those bytes objects and only those using UTF-32.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24894] iso-8859-11 missing from codecs table

2015-09-23 Thread Prashant Tyagi

Prashant Tyagi added the comment:

That was mistake in previous patch,so here is new patch for the same.

--
Added file: http://bugs.python.org/file40557/issue_24894.patch

___
Python tracker 

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



[issue25223] Statically or dynamically linked to the VC++runtime ? or how Python install fails on Vista despite the VC redist packages - api-ms-win-crt-runtime-l1-1-0.dll

2015-09-23 Thread acx01bc

Changes by acx01bc :


--
title: Statically or dynamically linked  to the VC++runtime ? or how Python 
install fails o Vista despite the VC redist packages - 
api-ms-win-crt-runtime-l1-1-0.dll -> Statically or dynamically linked  to the 
VC++runtime ? or how Python install fails on Vista despite the VC redist 
packages - api-ms-win-crt-runtime-l1-1-0.dll

___
Python tracker 

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



[issue25210] Special-case NoneType() in do_richcompare()

2015-09-23 Thread STINNER Victor

STINNER Victor added the comment:

R. David Murray wrote: "There are other places NoneType shows up (eg: attribute 
error).  Why should this case be special?  Do we want to fix them all?"

I think you missed the last sentence of the initial message :-) We are simply 
discussing a comment :-D

Ezio wrote: "if not, the comment should be removed."

Come on, just remove the comment, that's all ;-)

--

___
Python tracker 

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



[issue25205] setattr accepts invalid identifiers

2015-09-23 Thread R. David Murray

R. David Murray added the comment:

I did however make the same mistake without checking the docs or the behavior.  
But the fact that I didn't look at it doesn't make the current documentation 
wrong :)

What change is it that you think would be beneficial?

--

___
Python tracker 

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



[issue25194] Register of Financial Interests for core contributors

2015-09-23 Thread R. David Murray

R. David Murray added the comment:

Antoine: think that's exactly what Nick has in mind, exposing that kind of 
information.

--

___
Python tracker 

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2015-09-23 Thread Brett Cannon

Brett Cannon added the comment:

Yes, a text box or something along those lines. I assume the selection label 
question is to specify a section of the change log for something to go into. 
That's actually not necessary as the proper section is implied by the 
Components label.

And we could allow people to initially fill it in if desired, but I think 
worrying about whether to open it up or not is premature optimization; I'm fine 
with starting with it for only people with Developer privileges on the issue 
tracker.

--
components:  -2to3 (2.x to 3.x conversion tool)

___
Python tracker 

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



[issue25143] 3.5 install fails poorly on Windows XP

2015-09-23 Thread Tim Golden

Tim Golden added the comment:

I'd just bail as early as poss. from the installer. If it's possible to 
detect Windows versions, stick something like "The last version to 
support WinXP is 3.4". If that's too tricky, perhaps something "Your 
system may be unsupported. Please try an earlier version of Python"

--

___
Python tracker 

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



[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread R. David Murray

R. David Murray added the comment:

This may be opening a can of worms, but I wonder if what we should really do is 
re-engineer regrtest from the ground up, keeping the existing regrtest around 
until we are satisfied with its replacement...and maybe some of the options 
wouldn't make the transition.  (I've used --single, but it's been a long time, 
and I think it may have only been when I was testing regrtest after modifying 
it...)

We could then shift buildbots over to the new command gradually (or, do a few 
first, and then all the rest).  Then when we're satisfied we could change -m 
test to use the new interface, but keep regrtest around, unmaintained, for a 
couple of releases for those who are still using it.

I haven't looked at Victor's code to see if I like his re-engineering, but I'm 
really talking about starting the re-engineering from the API, and only then 
thinking about the code to implement it.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread STINNER Victor

STINNER Victor added the comment:

"This may be opening a can of worms, but I wonder if what we should really do 
is re-engineer regrtest from the ground up,"

It's not a full reengineering. My patch takes the current code and split it 
into smaller files. It's not a new implementation or anything like that.

"keeping the existing regrtest around until we are satisfied with its 
replacement..."

why are you saying "replacement"? Replaced by what?

"(I've used --single, but it's been a long time, and I think it may have only 
been when I was testing regrtest after modifying it...)"

You can propose to remove this option if you think that it's useless. I don't 
want to touch options, I don't know how regrtest is used, and regrtest works 
right? (If it works, don't touch it :-))

"I haven't looked at Victor's code to see if I like his re-engineering, but I'm 
really talking about starting the re-engineering from the API, and only then 
thinking about the code to implement it."

Sorry, but writing a new regrtest project is a full new project. Please open a 
new issue if you want to invest time on that.

--

___
Python tracker 

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



[issue25222] 3.5.0 regression - Fatal Python error: Cannot recover from stack overflow

2015-09-23 Thread Bernie Hackett

New submission from Bernie Hackett:

While running PyMongo's test suite against python 3.5.0 the interpreter 
inconsistently aborts when we test encoding a recursive data structure like:

evil = {}
evil['evil'] = evil

The test that triggers this was added to test the use of Py_EnterRecursiveCall 
in PyMongo's C extensions and passes without issues on all previous CPython 
releases back to 2.4.x (the oldest version PyMongo supports). The interesting 
thing about this abort is that it only occurs when testing PyMongo *without* 
its C extensions. The stacktrace looks like this:

test_bad_encode (test_bson.TestBSON) ... Exception ignored in: >
RecursionError: maximum recursion depth exceeded while calling a Python object
Fatal Python error: Cannot recover from stack overflow.
 
Thread 0x0b6c (most recent call first):
  File "C:\10gen\mongo-python-driver\pymongo\periodic_executor.py", line 105 in 
_run
  File "C:\Python35\lib\threading.py", line 871 in run
  File "C:\Python35\lib\threading.py", line 923 in _bootstrap_inner
  File "C:\Python35\lib\threading.py", line 891 in _bootstrap
 
Thread 0x0690 (most recent call first):
  File "C:\Python35\lib\threading.py", line 297 in wait
  File "C:\10gen\mongo-python-driver\pymongo\thread_util.py", line 199 in wait
  File "C:\10gen\mongo-python-driver\pymongo\periodic_executor.py", line 110 in 
_run
  File "C:\Python35\lib\threading.py", line 871 in run
  File "C:\Python35\lib\threading.py", line 923 in _bootstrap_inner
  File "C:\Python35\lib\threading.py", line 891 in _bootstrap
 
Thread 0x0900 (most recent call first):
  File "C:\Python35\lib\threading.py", line 297 in wait
  File "C:\10gen\mongo-python-driver\pymongo\thread_util.py", line 199 in wait
  File "C:\10gen\mongo-python-driver\pymongo\periodic_executor.py", line 110 in 
_run
  File "C:\Python35\lib\threading.py", line 871 in run
  File "C:\Python35\lib\threading.py", line 923 in _bootstrap_inner
  File "C:\Python35\lib\threading.py", line 891 in _bootstrap
 
Current thread 0x0a20 (most recent call first):
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 692 in 
_element_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
_encode_mapping
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in _encode_list
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 692 in 
_element_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
_encode_mapping
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in _encode_list
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 692 in 
_element_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
_encode_mapping
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in _encode_list
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 692 in 
_element_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
_encode_mapping
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in _encode_list
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 692 in 
_element_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 433 in 
_encode_mapping
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in 
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 462 in _encode_list
  File "C:\10gen\mongo-python-driver\bson\__init__.py", line 653 in 
_name_value_to_bson
  File 

[issue25222] 3.5.0 regression - Fatal Python error: Cannot recover from stack overflow

2015-09-23 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2015-09-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Larry: commit messages are for other developers, which news entries are 
ultimately for users.  Some developers want (insist on) the freedom to make the 
two different, with different details.  I am using that for Idle patches since 
NEWS entries become 'What New for Idle' in each release.

Brett, I presume that you mean a new NEWS box like this Comment box, maybe with 
3 lines and a new Section: box like Components.  Question: Is it impossible to 
put labels above a box rather than to the right?   

We could allow that news section to be (initially) filled out by someone other 
than the committer.  Latter could (optionally) copy and paste as (initial draft 
of) commit message.  Having message visible on issue might result in typos 
being corrected sooner, and would make it much easier to edit news message 
later (But editing after close should be limited to core devs).

Larry, a commit hook would be better that a separate pyci since TortoiseHG 
[Commit] button would still work.  With Brett's solution, a commit hook could 
email commit message to tracker as NEWS message (if empty).  And yes, change 
should apply to all versions.  Otherwise, NEWS commits to older versions would 
have to be null-merged.

--
components: +2to3 (2.x to 3.x conversion tool)

___
Python tracker 

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



[issue25085] Windows x86-64 embeddable zip file contains test directorys

2015-09-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Thanks, re-reading I see the new exclusion test for this issue:
  if name in {'test', 'tests'} and p.parts[-3].lower() == 'lib':

--

___
Python tracker 

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



[issue23329] _ssl cannot be compiled with LibreSSL anymore (on OpenBSD 5.5) because of ALPN

2015-09-23 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue25164] Windows default installation path is inconsistent between per-user and system-wide installation

2015-09-23 Thread Tim Golden

Tim Golden added the comment:

I don't feel that strongly, but my preference would be 
"python35[-whatever]" rather than the version with the spaces & the 
dots. Both for ease of use and for some kind of continuity with the 
c:\pythonxy we've had for many years.

--

___
Python tracker 

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



[issue25194] Register of Financial Interests for core contributors

2015-09-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

What would be the rules for how to fill this up?

For example, I work for Continuum, which develops Conda and Anaconda, but I'm 
not paid to work on CPython (I work on Numba). However, perhaps someone might 
want to ask for CPython work that aligns with Continuum's interests, and then 
I'd obviously be in the loop for the actual work.

--
nosy: +pitrou

___
Python tracker 

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2015-09-23 Thread R. David Murray

R. David Murray added the comment:

I believe auto-filling it from the commit message (for those who don't put in 
the effort to treat the two audiences differently :) was something we 
discussed, but it would be a separate enhancement after the news box is added 
to the tracker.  Which I might get to next month or I might not...

--

___
Python tracker 

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



[issue25222] 3.5.0 regression - Fatal Python error: Cannot recover from stack overflow

2015-09-23 Thread A. Jesse Jiryu Davis

Changes by A. Jesse Jiryu Davis :


--
nosy: +emptysquare

___
Python tracker 

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



[issue25220] Enhance and refactor test.regrtest (convert regrtest.py to a package)

2015-09-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset eaf9a99b6bb8 by Victor Stinner in branch 'default':
Issue #25220: Create Lib/test/libregrtest/
https://hg.python.org/cpython/rev/eaf9a99b6bb8

--
nosy: +python-dev

___
Python tracker 

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



[issue25225] Idle doc: redo Syntax Colors section

2015-09-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Current:
3. Syntax colors 

The coloring is applied in a background “thread,” so you may occasionally see 
uncolorized text.  To change the color scheme, edit the [Colors] section in 
config.txt.  

Python syntax colors: 
 
  Keywords 
orange 

  Strings 
   green 

  Comments 
red 

  Definitions 
blue   

Shell colors: 
 
  Console output 
brown 

  stdout 
blue 

  stderr 
dark green 

  stdin 
black

--

___
Python tracker 

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



[issue25225] Idle doc: redo Syntax Colors section

2015-09-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Possible alternative, with additions and corrections:

3. Syntax colors 

The coloring is applied in a background “thread,” so you may occasionally see 
uncolorized text.  To change the color scheme, edit the [Colors] section in 
config.txt.  

Python syntax colors: 
 
  Keywords: orange
  Builtins: purple
  Definitions: blue   
  Strings: green 
  Comments: red 

Shell colors: 
 
  Console output: brown
  Console error: black on red 
  stdin: black  
  stdout: blue 
  stderr: red

Other colors:
  Cursor: black
  Selected: black on gray
  Found: white on black

--

___
Python tracker 

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



[issue25225] Idle doc: redo Syntax Colors section

2015-09-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The alternative above matches the format of help.txt, except that the latter 
has the colors lined up.  The excessive addition of whitespace here was an 
argument against replacing help.txt with help.html (#16893).  I consider the 
proposed condensation to be most of a fix of a regression.

This sentence, "To change the color scheme, edit the [Colors] section in 
config.txt.", is strange in that it for help.txt, it was changed in 2002-12-11 
to refer to the Highlights tab of the Configure dialog.  In any case, the color 
list was added before that tab, but not seems not necessary.  As a 'repeat', it 
is subject to obsolescence if not updated, which it has not been.  So I think 
we should either drop the section or drop the colors and replace with a better 
description of what is being replaced.

2.4. Text and Syntax colors 

Text is both editor and shell windows get color coded. The coloring is applied 
in the background, so you may occasionally see uncolor text.  To change the 
color scheme, use the Configure IDLE dialog, Highlighting tab.

Colors can be set for the follow types of text. 

Python syntax in both editor and shell: normal code, keywords, builtin class 
and function names, user-defined class and function names, strings, and 
comments.

Shell output: console output, console error text, user output, and user error 
output and tracebacks. 
 
Other text: cursor, selected text, and text found by search.  

Debugger breakpoint lines in the editor are indicated by a dark yellow 
background (not configurable).


Note: I believe the marking of found text is OS dependent and know that it is 
the subject of discussion in other issues, so this part needs elaboration.

--

___
Python tracker 

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2015-09-23 Thread Nick Coghlan

Nick Coghlan added the comment:

I think Larry's "split news" and "merge news" ideas are still useful as a 
bridging mechanism to help us get from the status quo to a tracker based 
solution.

It would just mean that, at some point in the future, the commit hook would 
change to be a post-commit hook that pushed to the issue tracker, rather than a 
pre-commit hook writing to a file in the source repo, and "merge news" would 
start pulling from the tracker, rather than from the source repo.

--

___
Python tracker 

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



Re: 64bit Python builds on HP-UX ia64 and PA-RISC (Using GCC)

2015-09-23 Thread Laura Creighton
In a message of Wed, 23 Sep 2015 09:03:21 +0100, James Matthews writes:
>Hi,
>
>I'm having some issues getting 64bit Python builds on HP-UX. I'm using the
>GCC version available from the HP website. I've also tried using HP's
>compiler but don't have much success either, even following the readme.
>These are the results I get:
>
>PA-RISC:
>
>./configure CC=/opt/hp-gcc64-4.7.1/bin/gcc
>make
>
>Traceback (most recent call last):
>  File "./setup.py", line 2240, in 
>main()
>  File "./setup.py", line 2235, in main
>'Lib/smtpd.py']
>  File "/tmp/jxm/Python-2.7.10/Lib/distutils/core.py", line 151, in setup
>dist.run_commands()
>  File "/tmp/jxm/Python-2.7.10/Lib/distutils/dist.py", line 953, in
>run_commands
>self.run_command(cmd)
>  File "/tmp/jxm/Python-2.7.10/Lib/distutils/dist.py", line 972, in
>run_command
>cmd_obj.run()
>  File "/tmp/jxm/Python-2.7.10/Lib/distutils/command/build.py", line 127,
>in run
>self.run_command(cmd_name)
>  File "/tmp/jxm/Python-2.7.10/Lib/distutils/cmd.py", line 326, in
>run_command
>self.distribution.run_command(command)
>  File "/tmp/jxm/Python-2.7.10/Lib/distutils/dist.py", line 972, in
>run_command
>cmd_obj.run()
>  File "/tmp/jxm/Python-2.7.10/Lib/distutils/command/build_ext.py", line
>337, in run
>self.build_extensions()
>  File "./setup.py", line 251, in build_extensions
>build_ext.build_extensions(self)
>  File "/tmp/jxm/Python-2.7.10/Lib/distutils/command/build_ext.py", line
>446, in build_extensions
>self.build_extension(ext)
>  File "./setup.py", line 287, in build_extension
>if not self.configure_ctypes(ext):
>  File "./setup.py", line 2041, in configure_ctypes
>exec f in fficonfig
>  File "build/temp.hp-ux-B.11.31-9000-800-2.7/libffi/fficonfig.py", line
>33, in 
>ffi_sources += ffi_platforms['PA64_HPUX']
>KeyError: 'PA64_HPUX'
>*** Error exit code 1
>
>During make I also get lots of errors like this: ./pyconfig.h:1188:0:
>warning: "_POSIX_C_SOURCE" redefined [enabled by default]
>
>
>ia64:
>
>./configure CC=/opt/hp-gcc-4.7.1/bin/gcc CFLAGS="-mlp64"
>Make
>
>./pyconfig.h:1188:0: warning: "_POSIX_C_SOURCE" redefined [enabled by
>default]
>:0:0: note: this is the location of the previous definition
>/opt/hp-gcc-4.7.1/bin/gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall
>-Wstrict-prototypes  Parser/acceler.o  Parser/grammar1.o
>Parser/listnode.o  Parser/node.o  Parser/parser.o  Parser/parsetok.o
>Parser/bitset.o  Parser/metagrammar.o  Parser/firstsets.o
>Parser/grammar.o  Parser/pgen.o Objects/obmalloc.o  Python/mysnprintf.o
>Python/pyctype.o  Parser/tokenizer_pgen.o  Parser/printgrammar.o
>Parser/pgenmain.o -lnsl -lrt -ldld -ldl  -o Parser/pgen
>ld: Mismatched Data ABI. Expected None but found EF_IA_64_ABI64 in file
>Parser/acceler.o
>Fatal error.
>collect2: error: ld returned 1 exit status
>*** Error exit code 1
>Stop.
>*** Error exit code 1
>
>Seems to be a library mismatch?
>
>Any help would be appreciated.
>
>Regards,
>James
>-- 
>https://mail.python.org/mailman/listinfo/python-list

I think you have this problem.
http://h30499.www3.hp.com/t5/Languages-and-Scripting/Conpilation-errors-on-HP-UX-11-31-IA64/td-p/4777801#.VgJtfUlZLZs

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


Re: Successfully send sms with python

2015-09-23 Thread Laura Creighton
In a message of Tue, 22 Sep 2015 22:25:31 -0600, Michael Torrie writes:

>Consider something like this with no error checking when using the
>serial port, no context managers for the serial device:
>file sms.py:
>--
>import serial
>import time
>
>serial_port = 'COM13'
>timeout = 5
>baud = 460800
>
>def send_message(recipient, message):
>ser = serial.Serial(serial_port, baud, timeout=timeout)
>time.sleep(1)
>self.ser.write('ATZ\r')
>time.sleep(1)
>self.ser.write('AT+CMGF=1\r')
>time.sleep(1)
>self.ser.write('''AT+CMGS="''' + self.recipient + '''"\r\n''')
>time.sleep(1)
>self.ser.write(self.content + "\r\n")
>time.sleep(1)
>self.ser.write(chr(26))
>time.sleep(1)
>print "message sent!"
>
>ser.close()

2 questions.
Why all the sleep(1)s?
and don't you need to flush the thing after each write?

Laura

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


Re: Dummy Decoder Example (was Re: Parallel decoding lesson for you.)

2015-09-23 Thread Skybuck Flying

The example may be modified as much as needed.

For now my solution needs a little reading pad to avoid costly mods or 
branches or whatever.


I think this is a nice speedy solution, so code may be modified as follows:

const
MaxProcessorCount = 4;
var
// information stream, input
Stream : array[0..20+(MaxProcessorCount-1)] of integer; // add max processor 
count to create a safe "padding" for reading so no out of bounds/range check 
errors with arrays.


Bye,
 Sybuck.


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


Re: Dummy Decoder Example (was Re: Parallel decoding lesson for you.)

2015-09-23 Thread Skybuck Flying
Here is the C version of the example in case your Delphi-to-C skills are not 
so great or you lazy lol =D:


// ParallelDecodingCVersion.cpp : Defines the entry point for the console 
application.

//

#include "stdafx.h"

// Begin of Dummy Decoder Example

const int MaxProcessorCount = 4;

int _tmain(int argc, _TCHAR* argv[])
{
// information stream, input
int Stream[21+(MaxProcessorCount-1)]; // add max processor count to create a 
safe "padding" for reading so no out of bounds/range check errors with 
arrays.


// bits representing fields of data
int a1,a2,a3,a4;
int b1,b2,b3;
int c1;
int d1,d2,d3,d4,d5,d6;

// output
int RowIndex;

int RowCount;
int RowLength[6];
int RowOffset[6];

int DataOffset;

int FieldCount;
int FieldLength;

int Processor[4];

// debug fields
int FieldA;
int FieldB;
int FieldC;
int FieldD;

a1 = 1; a2 = 1; a3 = 1; a4 = 1;
b1 = 1; b2 = 1; b3 = 1;
c1 = 1;
d1 = 1; d2 = 1; d3 = 1; d4 = 1; d5 = 1; d6 = 1;

// compute input fields to compare it later with output fields
FieldA = (a1) | (a2 << 1) | (a3 << 2) | (a4 << 3);
FieldB = (b1) | (b2 << 1) | (b3 << 2);
FieldC = (c1);
FieldD = (d1) | (d2 << 1) | (d3 << 2) | (d4 << 3) | (d5 << 4) | (d6 << 5);

// print field values
printf( "FieldD: %d \n", FieldD );
printf( "FieldA: %d \n", FieldA );
printf( "FieldB: %d \n", FieldB );
printf( "FieldC: %d \n\n", FieldC );

// number of rows
Stream[0] = 6;

// row lengths
Stream[1] = 4;
Stream[2] = 3;
Stream[3] = 3;
Stream[4] = 2;
Stream[5] = 1;
Stream[6] = 1;

// sorted information stream:
// d1a1b1c1d2a2b2d3a3b3d4a4d5d6

// data bits
Stream[7] = d1;
Stream[8] = a1;
Stream[9] = b1;
Stream[10] = c1;
Stream[11] = d2;
Stream[12] = a2;
Stream[13] = b2;
Stream[14] = d3;
Stream[15] = a3;
Stream[16] = b3;
Stream[17] = d4;
Stream[18] = a4;
Stream[19] = d5;
Stream[20] = d6;

// now the decoding algorithm:

// determine number of rows
RowCount = Stream[0];

// extract row lengths
RowLength[0] = Stream[1];
RowLength[1] = Stream[2];
RowLength[2] = Stream[3];
RowLength[3] = Stream[4];
RowLength[4] = Stream[5];
RowLength[5] = Stream[6];

// determine field count
FieldCount = RowLength[0]; // row[0] indicates number of fields.

// I will help out a bit... by leaving this code in ! ;) seems somewhat 
obvious ;)

// first determine data offset properly ! ;) :) 1 for the row count +
// RowCount to skip over row lengths.
DataOffset = 1 + RowCount;

RowOffset[0] = DataOffset;
RowOffset[1] = RowOffset[0] + RowLength[0];
RowOffset[2] = RowOffset[1] + RowLength[1];
RowOffset[3] = RowOffset[2] + RowLength[2];
RowOffset[4] = RowOffset[3] + RowLength[3];
RowOffset[5] = RowOffset[4] + RowLength[4];


// some how the data bits from the stream needs to end up in these 4
// processors so that it produces the same values
// as below:
// fields may be processed in a different order though.

// *** You will need to replace this code with your own code... and
// preferably it should be parallel, fast and somewhat general/scalable. ***
Processor[0] = FieldD;
Processor[1] = FieldA;
Processor[2] = FieldB;
Processor[3] = FieldC;

// print processor values.
printf( "Processor[0]: %d \n", Processor[0] );
printf( "Processor[1]: %d \n", Processor[1] );
printf( "Processor[2]: %d \n", Processor[2] );
printf( "Processor[3]: %d \n\n", Processor[3] );

return 0;
}

// End of Dummy Decoder Example

Bye,
 Skybuck :)


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


  1   2   >