EuroPython 2015: Vote for the talks you want to see

2015-05-04 Thread M.-A. Lemburg
Having received over 300 great proposals for talks, trainings,
helpdesks and posters, we now call out to all attendees to vote for
what you want to see on the conference schedule.

You can search for topics and communicate your personal priorities by
casting your vote for each submission on our talk voting page:


*** ​Attendees: This is your chance to shape the conference ! ***

 https://ep2015.europython.eu/en/talk-voting/

Talk voting will be open until Friday, May 15.

The program workgroup (WG) will then use the talk voting results as
basis for their talk selection and announce the schedule late in May.

Enjoy,
--
EuroPython 2015 Team
http://ep2015.europython.eu/
http://www.europython-society.org/
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


[issue20159] Derby #7: Convert 51 sites to Argument Clinic across 3 files - Derby: Convert the ElementTree module to use Argument Clinic

2015-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Made compatible with Windows compiler (I hope).

--
Added file: http://bugs.python.org/file39285/etree_clinic_3.patch

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



[issue20159] Derby #7: Convert 51 sites to Argument Clinic across 3 files - Derby: Convert the ElementTree module to use Argument Clinic

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

LGTM

--

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



[issue23670] Modifications to support iOS as a cross-compilation target

2015-05-04 Thread Russell Keith-Magee

Russell Keith-Magee added the comment:

This new patch (20150504.diff) adds support for running the Python test suite 
The new patch is standalone, and contains everything in the previous patch.

An XCode project (Tools/iOS-test) has been added to the source tree; this 
project contains bootstrap C code to start and run the full Python regression 
test suite.

There's also a new target in the iOS/Makefile meta-buildfile - make test - 
which will compile a debug version of the Python framework, and install it into 
the iOS-test project.

Getting the test suite to run has revealed one major limitation of the iOS 
platform - system calls like fork, exec*, and spawn* don't work. The OS calls 
*exist* at an API level - but if you use them, they either crash, or they lock 
up the device while you wait for a subprocess that will never execute. This 
makes sense considering the platform itself - there's no such thing as a 
background process in iOS; background tasks are very heavily sandboxed. 

A number of other minor problems have been identified as a result of running 
the full test suite; they have been addressed in the patch.

The test suite still has 5 failures on the simulator. I'm investigating the 
cause of these failures.

There's a couple of more failures on a physical device - 13 failures in total. 
These device-specific failures appear to be largely due to ctypes problems and 
a permissions issue with os.mkdir. 

If you run the test suite in XCode as a debug binary, the debugger will stop 
whenever a SIGPIPE, SIGINT, SIGXFSZ, SIGUSR1 or SIGUSR2 signal is raised. You 
can just hit continue in the debugger, and the test will continue. To work 
around this, you need to run the following debugger commands before the first 
signal is raised:

process handle SIGPIPE -n true -p true -s false
process handle SIGINT -n true -p true -s false
process handle SIGXFSZ -n true -p true -s false
process handle SIGUSR1 -n true -p true -s false
process handle SIGUSR2 -n true -p true -s false

I've been doing this by setting a breakpoint in the main.c method; I'm 
investigating other ways to automate this.

--
Added file: http://bugs.python.org/file39286/20150504.diff

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



[issue2824] zipfile to handle duplicate files in archive

2015-05-04 Thread Wessel Badenhorst

Changes by Wessel Badenhorst wess...@gmail.com:


--
type:  - enhancement

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



[issue3539] Problem with testembed make dependencies in certain circumstances

2015-05-04 Thread Wessel Badenhorst

Changes by Wessel Badenhorst wess...@gmail.com:


--
type:  - compile error

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



[issue3786] _curses, _curses_panel _multiprocessing can't be build in 2.6b3 w/ SunStudio 12

2015-05-04 Thread Wessel Badenhorst

Changes by Wessel Badenhorst wess...@gmail.com:


--
type:  - compile error

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



[issue24122] Install fails after configure sets the extending/embedding install directory to NONE

2015-05-04 Thread Xavier de Gaye

Changes by Xavier de Gaye xdeg...@gmail.com:


--
nosy: +larry

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2015-05-04 Thread Mark Lawrence

Mark Lawrence added the comment:

Is this now fixed in VS?  I don't believe I can test myself as I've only got 
express/community editions.

--
components: +Windows
nosy: +BreamoreBoy

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



[issue24123] Python 2.7 Tutorial Conflicting behavior with WeakValueDictionary.

2015-05-04 Thread R. David Murray

R. David Murray added the comment:

Well, technically it is probably not a bug.  IPython is doubtless holding on to 
a reference to 'a' because it was defined at the prompt.  Perhaps it could use 
a weakvaluedict for that, though :)  On the other hand they might consider it a 
feature that objects don't go out of scope.

--
stage:  - resolved

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



[issue24099] Use after free in siftdown (1)

2015-05-04 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue24101] Use after free in siftup

2015-05-04 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue24100] Use after free in siftdown (2)

2015-05-04 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue20179] Derby #10: Convert 50 sites to Argument Clinic across 4 files

2015-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I can propose three remedies:
 
 A) back out the Clinic conversion in _ssl.c
 B) support Clinic in 2.7 just for _ssl.c
 C) do a one-time backport of the Clinic generated code for _ssl.c

I'd rather have A or C than B.
By the way, this discussion seems to focus on 2.7, but the same issue happens 
with 3.4 (although Clinic already exists here, so we can just backport Serhiy's 
work).

--

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



[issue20179] Derby #10: Convert 50 sites to Argument Clinic across 4 files

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

Clinic's syntax is diverging from what shipped with 3.4.  So if you copied 
_ssl.c over, it wouldn't work with the Clinic that shipped with 3.4.

Maybe the best thing is if Clinic in trunk supports legacy mode, where the 
code it generates is compatible with previous Python versions.  That's 
basically B but without doing something crazy like shipping Clinic with 2.7.

--

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



[issue20159] Derby #7: Convert 51 sites to Argument Clinic across 3 files - Derby: Convert the ElementTree module to use Argument Clinic

2015-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fea94f9cb5a0 by Serhiy Storchaka in branch 'default':
Issue #20159. Converted the _elementtree module to Argument Clinic.
https://hg.python.org/cpython/rev/fea94f9cb5a0

--
nosy: +python-dev

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



[issue24116] --with-pydebug has no effect when the final python binary is compiled

2015-05-04 Thread Skip Montanaro

Skip Montanaro added the comment:

 It's confusing that the CFLAGS specified when running make are passed further 
 sometimes but not always. So I guess that's a workaround? Or CFLAGS should 
 never be specified to make directly?

In my experience, all the magic happens in configure. Most of the time, the 
only flag I give to make is -j to specify parallelism.

Is there somewhere in the build docs this could be made clearer?

--
nosy: +skip.montanaro

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



[issue20168] Derby: Convert the _tkinter module to use Argument Clinic

2015-05-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue20148] Derby: Convert the _sre module to use Argument Clinic

2015-05-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue20159] Derby #7: Convert 51 sites to Argument Clinic across 3 files - Derby: Convert the ElementTree module to use Argument Clinic

2015-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Original issue is resolved and I have no any relations to modules added by 
Larry.

--
dependencies:  -Add docstrings for ElementTree module
stage: patch review - needs patch

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



[issue20159] Derby #7: Convert 51 sites to Argument Clinic across 3 files - Derby: Convert the ElementTree module to use Argument Clinic

2015-05-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy:  -serhiy.storchaka

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



[issue24124] Two versions of instructions for installing Python modules

2015-05-04 Thread Skip Montanaro

New submission from Skip Montanaro:

I was hunting around the current website for notes on installing Python. 
Couldn't find any (BTW), so I looked in the Python source. Imagine my surprise 
to find two apparently overlapping files describing how to build Python modules:

./Doc/install/index.rst
./Doc/installing/index.rst

The former is marked Legacy version. The latter seems to cover mostly 
installation of third-party modules using tools like pip. The former covers 
distutils.  Oddly enough, the legacy version seems to have been updated more 
recently than the presumably current version. Do we really need to keep both 
versions around at this point? Should they be merged into a single document? If 
they are to both be retained, should the legacy version be marked as such more 
clearly and refer readers to the pip/pyvenv/virtualenv version?

--
assignee: docs@python
components: Documentation
messages: 242555
nosy: docs@python, skip.montanaro
priority: normal
severity: normal
status: open
title: Two versions of instructions for installing Python modules
versions: Python 3.5

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



[issue24102] Multiple type confusions in unicode error handlers

2015-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Also fixed handling errors of PyObject_IsSubclass() (issue24115) in the _codecs 
module.

--
Added file: 
http://bugs.python.org/file39287/codecs_error_handlers_issubclass_3.patch

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



[issue23911] Move path-based bootstrap code to a separate frozen file.

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

This checkin broke the buildbots.  If you build trunk then run

./python -bb -m test test_site

the test fails.  -bb is used by the normal test runner (make test).

The problem is in the lines

self.assertTrue(os.path.isabs(os__file__),
expected absolute path, got {}.format(os__file__))
self.assertTrue(os.path.isabs(os__cached__),
expected absolute path, got {}.format(os__cached__))

os__file__ and os__cached__ are bytes but you're passing them into .format() on 
a str.

--
nosy: +larry
resolution: fixed - 
status: closed - open

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



[issue24001] Clinic: use raw types in types= set

2015-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 41fb7fd04b5d by Larry Hastings in branch 'default':
Issue #24001: Argument Clinic converters now use accept={type}
https://hg.python.org/cpython/rev/41fb7fd04b5d

--
nosy: +python-dev

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



[issue24088] yield expression confusion

2015-05-04 Thread Jim Jewett

Jim Jewett added the comment:

OK, then how about

Current:

When a generator function is called, it returns an iterator known as a 
generator. That generator then controls the execution of a generator function. 
The execution starts when one of the generator’s methods is called.


Proposed:

When a generator function is called, it does not complete its execution 
immediately.  Instead, it keeps its execution frame intact, and returns a 
special kind of iterator known as a generator. The iteration starts when one of 
the generator’s methods is called, and the generator executes within the 
existing generator frame, rather than creating a new one.


This still seems to suggest that the generator uses the same frame as the 
generator function that created it; I was not aware that this was a guarantee.  
(Reusing the same frame, yes.  Reusing that particular frame, no.)

--

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



[issue24119] Carry comments with the AST

2015-05-04 Thread Brett Cannon

Brett Cannon added the comment:

Normally I would agree comments don't belong there, but if we are going to 
start giving them semantic meaning then I don't think it's not so clear to me 
anymore.

As to where to attach, simple place is off of the Module node. Another is to 
have it be fundamental like lineno and only attach it when it is a 
line-trailing comment.

Yes, the tokenize module will give you the comments as well, but it is 
unfortunate you have to parse the code twice in order to get the comments and 
the AST.

--

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



[issue24088] yield expression confusion

2015-05-04 Thread R. David Murray

R. David Murray added the comment:

I don't think anything about frames is guaranteed as part of the language, so 
I'm not sure that mention of it belongs in the description.  Personally, I find 
your reformulation more confusing that the original with 'a' replaced by 'the'.

--

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



[issue24119] Carry comments with the AST

2015-05-04 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
nosy: +christian.heimes

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



[issue24001] Clinic: use raw types in types= set

2015-05-04 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

Here's a freshened version of the patch.  I updated the Clinic HOWTO.

Serhiy: You're right, length and zeroes always have the same value.  Would you 
ever want length without allowing zeroes?  Like, in the future, would we ever 
want
str(length=True)
so we're passed in the length but we still don't want to allow zeroes?

--
Added file: 
http://bugs.python.org/file39288/larry.one.more.clinic.format.unit.map.cleanup.4.txt

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I would say it is very unlikely. In any case, if we have a pointer and a 
length, we always can check for zeros after parsing.

May be rename the str converter to pchar and the Py_UNICODE converter to 
pwchar? Usually the converter is named by C type, not Python type. y and y# 
even don't accept str.

--

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



[issue24086] Configparser interpolation is unexpected

2015-05-04 Thread Trevor Bekolay

Trevor Bekolay added the comment:

Thanks for the quick response! I can see the use case for using interpolation 
in .pypirc. Unfortunately for me, I push releases for both Python 2 and Python 
3, so having the double percent sign will cause problems for me on Python 2.

The exception that's being raised is at line 442 
(https://hg.python.org/cpython/file/default/Lib/configparser.py#l442). The 
message itself seems to have the right information, but setuptools seems to 
mangle it  (perhaps InterpolationSyntaxError needs a __repr__ or __str__?)

--

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



[issue23911] Move path-based bootstrap code to a separate frozen file.

2015-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 36b902bbc992 by Eric Snow in branch 'default':
Issue #23911: Fix mixed bytes/strings.
https://hg.python.org/cpython/rev/36b902bbc992

--

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



[issue23911] Move path-based bootstrap code to a separate frozen file.

2015-05-04 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
resolution:  - fixed
status: open - pending

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



[issue3367] Uninitialized value read in parsetok.c

2015-05-04 Thread Mark Lawrence

Mark Lawrence added the comment:

The fix proposed by Alexander in issue3367.diff has never been applied.  How 
would I go about reproducing the original issue on Windows?

--
nosy: +BreamoreBoy
versions: +Python 3.4, Python 3.5 -Python 3.3

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

I have no interest in naming str to pchar.

Yes, *most* of the other converters are named after the C type they translate 
to.  But so far converter names doesn't mention whether or not they represent 
pointers to types--it's object, not pobject, it's PyBytesObject, not 
pPyBytesObject.  That suggests the name char for the converter.  But we've 
already got a char, and it would be confusing to use that one converter for 
both chars (small ints / single characters) and strings.

Adding p in front is not a convention we've ever used.  The word pchar does 
not appear in the Python source tree.  So the name pchar has no mnemonic 
value.

If I were to follow your advice, I should prefer the name char_star.  But now 
we're using nine letters for what is almost certainly the most common 
converter.  And, again, the generic converter for objects is called object, I 
do not propose to rename it to object_star.  So this converter's name would 
be an exception to the rule.

But then again, C strings themselves are an exception to the rule.  They're not 
a built-in type as much as they are a *convention*.  So any name we give it 
will ultimately be something of a compromise.  And as compromises go str is 
great.  So far nobody has been confused by it.  It's short, and universally, 
instantly clear as to its meaning.

Furthermore, converters don't actually represent a C type.  They represent a 
*mapping*, from a Python type (or types) to a single C type.  So while it's a 
useful and productive convention to name converters after the type they convert 
to, it's hardly mandatory.  And it would be a shame to squander clarity in 
service to a needless consistency.

p.s. If we hold ourselves to this firm ideal, where every converter is named 
after its C type, what should we call the bool converter?  What should we 
call the self converter?  What should you call your proposed boolint 
converter?

--

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

Here's an updated patch where I've removed the length parameter to 
converters, instead relying solely on the zeroes parameter.

--
Added file: 
http://bugs.python.org/file39289/larry.one.more.clinic.format.unit.map.cleanup.5.txt

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



[issue1100942] Add datetime.time.strptime and datetime.date.strptime

2015-05-04 Thread Mark Lawrence

Mark Lawrence added the comment:

@Alexander as the datetime expert could you get this committed in time for 3.5?

--
nosy: +BreamoreBoy

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



[issue17477] update the bsddb module do build with db 5.x versions

2015-05-04 Thread Mark Lawrence

Mark Lawrence added the comment:

From 
http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html
 the latest version is 6.1.23.  Given the extended life span of 2.7 I'd assume 
that the patch here is worth updating.  See also #18734.

--
nosy: +BreamoreBoy

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

As for str doesn't even accept str for y and y#, the name str is not for 
the Python type, it's for the C type.

--

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



[issue23911] Move path-based bootstrap code to a separate frozen file.

2015-05-04 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
status: pending - closed

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why not left the length parameter instead? First, current code uses length. 
Second, the main effect from C side is that an argument is a pair (pointer, 
length), not just a pointer. Third, currently everywhere in Python 
documentation and error messages the used term is null character/byte, so if 
left the zeros parameter, it should be renamed to allow_nulls or allow_nuls. 
Fourth, y# needs zeros=True for distinguish from y, but y* allows nulls 
and has no the zeros parameter.

--

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be string, or data, or buffer would be better names? str looks as 
Python type.

--

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

I don't think those are better names.

--

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



EuroPython 2015: Vote for the talks you want to see

2015-05-04 Thread M.-A. Lemburg
Having received over 300 great proposals for talks, trainings,
helpdesks and posters, we now call out to all attendees to vote for
what you want to see on the conference schedule.

You can search for topics and communicate your personal priorities by
casting your vote for each submission on our talk voting page:


*** ​Attendees: This is your chance to shape the conference ! ***

 https://ep2015.europython.eu/en/talk-voting/

Talk voting will be open until Friday, May 15.

The program workgroup (WG) will then use the talk voting results as
basis for their talk selection and announce the schedule late in May.

Enjoy,
--
EuroPython 2015 Team
http://ep2015.europython.eu/
http://www.europython-society.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
But when I do:
import urllib3.contrib.pyopenssl
I get:
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py, 
line 55, in module
import OpenSSL.SSL
  File /usr/lib64/python3.4/site-packages/OpenSSL/__init__.py, line 8, in 
module
from OpenSSL import rand, crypto, SSL
  File /usr/lib64/python3.4/site-packages/OpenSSL/rand.py, line 9, in 
module
from six import integer_types as _integer_types
ImportError: No module named 'six'

When I then give:
pip3 install -U OpenSSL
It goes wrong:
Could not fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client 
Error: Not Found

I checked and even
https://pypi.python.org/simple/
does not exist. Anyone an idea what is happening here?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


when does newlines get set in universal newlines mode?

2015-05-04 Thread arekfu
Hi all,

I have a text file with Windows-style line terminators (\r\n) which I open in 
universal newlines mode (Python 2.7). I would expect the newlines attribute to 
be set after the first call to the readline() method, but apparently this is 
not the case:

 f=open('test_crlf', 'rU')
 f.newlines
 f.readline()
'foo\n'
 f.newlines
 f.readline()
'bar\n'
 f.newlines
'\r\n'
On the other hand, the newlines attribute gets set after the first call to 
readline() on a file with Unix-style line endings.

Is this a bug or a feature?

Thanks in advance,
Davide
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 6:58 PM, Cecil Westerhof ce...@decebal.nl wrote:
 When I then give:
 pip3 install -U OpenSSL
 It goes wrong:
 Could not fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client 
 Error: Not Found

 I checked and even
 https://pypi.python.org/simple/
 does not exist. Anyone an idea what is happening here?

I think what you want is called pyOpenSSL, not just OpenSSL:

https://pypi.python.org/pypi/pyOpenSSL
https://pypi.python.org/simple/pyopenssl/

Not sure why /simple/ doesn't work, but you're not normally meant to
grab that page manually - it's for script work. You could raise a
tracker issue about that if you like, but it may not be considered
important.

Does 'pip3 install -U pyOpenSSL' work?

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


Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Cecil Westerhof
While copying pasting code to test, the following works:
from itertools  import islice
from os import rename
from os.pathimport expanduser, split
from tempfile   import NamedTemporaryFile

real_file = (expanduser('~/Twitter/testing.txt'))
(filepath,
 file)  = split(real_file)
with NamedTemporaryFile(mode = 'w', prefix = file + '_', dir = filepath, 
delete = False) as tf:
tempfile = tf.name
with open(real_file, 'r') as f:
for line in islice(f, 1, None):
tf.write(line)

rename(tempfile, real_file)

But first I used:
from itertools  import islice
from os import rename
from os.pathimport expanduser, split
from tempfile   import NamedTemporaryFile

real_file = (expanduser('~/Twitter/testing.txt'))
(filepath,
 file)  = split(real_file)
with NamedTemporaryFile(mode = 'w', prefix = file + '_', dir = filepath, 
delete = False) as tf:
tempfile = tf.name
with open(real_file, 'r') as f:
for line in islice(f, 1, None):
tf.write(line)
rename(tempfile, real_file)

But that gave:
  File stdin, line 6
rename(tempfile, real_file)
 ^
SyntaxError: invalid syntax

Why?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Peter Otten
are...@gmail.com wrote:

 Hi all,
 
 I have a text file with Windows-style line terminators (\r\n) which I open
 in universal newlines mode (Python 2.7). I would expect the newlines
 attribute to be set after the first call to the readline() method, but
 apparently this is not the case:
 
 f=open('test_crlf', 'rU')
 f.newlines
 f.readline()
 'foo\n'
 f.newlines
 f.readline()
 'bar\n'
 f.newlines
 '\r\n'
 On the other hand, the newlines attribute gets set after the first call to
 readline() on a file with Unix-style line endings.
 
 Is this a bug or a feature?

According to

https://docs.python.org/2.7/library/functions.html#open


If Python is built without universal newlines support a mode with 'U' is the 
same as normal text mode. Note that file objects so opened also have an 
attribute called newlines which has a value of None (if no newlines have yet 
been seen), '\n', '\r', '\r\n', or a tuple containing all the newline types 
seen.


I tried:

 with open(tmp.txt, wb) as f: f.write(alpha\r\nbeta\rgamma\n)
... 
 f = open(tmp.txt, rU)
 f.newlines
 f.readline()
'alpha\n'
 f.newlines 
# expected: '\r\n'
 f.readline()
'beta\n'
 f.newlines
'\r\n' # expected: ('\r', '\r\n')
 f.readline()
'gamma\n'
 f.newlines
('\r', '\n', '\r\n')

I believe this is a bug.

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


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 12:10 CEST schreef Chris Angelico:

 On Mon, May 4, 2015 at 6:58 PM, Cecil Westerhof ce...@decebal.nl wrote:
 When I then give: pip3 install -U OpenSSL It goes wrong: Could not
 fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client
 Error: Not Found

 I checked and even
 https://pypi.python.org/simple/
 does not exist. Anyone an idea what is happening here?

 I think what you want is called pyOpenSSL, not just OpenSSL:

 https://pypi.python.org/pypi/pyOpenSSL
 https://pypi.python.org/simple/pyopenssl/

 Not sure why /simple/ doesn't work, but you're not normally meant to
 grab that page manually - it's for script work. You could raise a
 tracker issue about that if you like, but it may not be considered
 important.

 Does 'pip3 install -U pyOpenSSL' work?
Not really, because that gives:
Requirement already up-to-date: pyOpenSSL in 
/usr/lib64/python3.4/site-packages
Cleaning up...

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 9:31 PM, Cecil Westerhof ce...@decebal.nl wrote:
 While copying pasting code to test, the following works:
 [chomp]
 But first I used:
 with NamedTemporaryFile(mode = 'w', prefix = file + '_', dir = filepath, 
 delete = False) as tf:
 tempfile = tf.name
 with open(real_file, 'r') as f:
 for line in islice(f, 1, None):
 tf.write(line)
 rename(tempfile, real_file)

 But that gave:
   File stdin, line 6
 rename(tempfile, real_file)
  ^
 SyntaxError: invalid syntax

 Why?

To clarify: When you say to test, you mean the interactive
interpreter, right? If so, you need to end blocks of text with blank
lines (and not have any blank lines in between). It's because the
parser has to know when to run stuff; when you run a script, it parses
the whole thing and then runs it, but interactively, it has to work
piece-meal.

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


Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 10:01 PM, Peter Otten __pete...@web.de wrote:
 I tried:

 with open(tmp.txt, wb) as f: f.write(alpha\r\nbeta\rgamma\n)
 ...
 f = open(tmp.txt, rU)
 f.newlines
 f.readline()
 'alpha\n'
 f.newlines
 # expected: '\r\n'
 f.readline()
 'beta\n'
 f.newlines
 '\r\n' # expected: ('\r', '\r\n')
 f.readline()
 'gamma\n'
 f.newlines
 ('\r', '\n', '\r\n')

 I believe this is a bug.

I'm not sure it is, actually; imagine the text is coming in one
character at a time (eg from a pipe), and it's seen alpha\r. It
knows that this is a line, so it emits it; but until the next
character is read, it can't know whether it's going to be \r or \r\n.
What should it do? Read another character, which might block? Put \r
into .newlines, which might be wrong? Once it sees the \n, it knows
that it was \r\n (or rather, it assumes that files do not have lines
of text terminated by \r followed by blank lines terminated by \n -
because that would be stupid).

It may be worth documenting this limitation, but it's not something
that can easily be fixed without removing support for \r newlines -
although that might be an option, given that non-OSX Macs are
basically history now.

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


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 9:32 PM, Cecil Westerhof ce...@decebal.nl wrote:
 Does 'pip3 install -U pyOpenSSL' work?
 Not really, because that gives:
 Requirement already up-to-date: pyOpenSSL in 
 /usr/lib64/python3.4/site-packages
 Cleaning up...

I don't know why it wasn't automatically installed, but 'six' is a
listed dependency of pyOpenSSL. What happens if you try to install
six?

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


http://premiumnaturalgarciniacambogiahelp.com/new-slim-5-garcinia-cambogia/

2015-05-04 Thread briansgoins via Python-list
New Slim 5 Garcinia Cambogia You can find plenty of Weight Loss tips one sees
around in company, infomercials, TV and publications. The stark reality is
that many of these tips actually work and a few really do not. To be honest
with you, the fat diets, weight products and pills recommendations or goods
are primarily those who don't function. Those who work so are fairly simple
to accomplish and are in reality easy to discover. They're largely
recommendations on DIETS and WORKOUTS. But I must contact your attention to
the recognition that the Weight Loss supplement marketplace is saturated in
the reality most situations is complicated to like the item being offered as
well as misleading tips and plenty of silly lies.

http://premiumnaturalgarciniacambogiahelp.com/new-slim-5-garcinia-cambogia/






--
View this message in context: 
http://python.6.x6.nabble.com/http-premiumnaturalgarciniacambogiahelp-com-new-slim-5-garcinia-cambogia-tp5094018.html
Sent from the Python - python-list mailing list archive at Nabble.com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Davide Mancusi
 I believe this is a bug.

 I'm not sure it is, actually; imagine the text is coming in one
 character at a time (eg from a pipe), and it's seen alpha\r. It
 knows that this is a line, so it emits it; but until the next
 character is read, it can't know whether it's going to be \r or \r\n.
 What should it do? Read another character, which might block? Put \r
 into .newlines, which might be wrong? Once it sees the \n, it knows
 that it was \r\n (or rather, it assumes that files do not have lines
 of text terminated by \r followed by blank lines terminated by \n -
 because that would be stupid).

I think this is a good point. However, I will probably submit a bug
report anyway and let the devs make their decisions. It is at least a
documentation bug.

Cheers,
Davide
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 14:14 CEST schreef Chris Angelico:

 On Mon, May 4, 2015 at 9:32 PM, Cecil Westerhof ce...@decebal.nl wrote:
 Does 'pip3 install -U pyOpenSSL' work?
 Not really, because that gives: Requirement already up-to-date:
 pyOpenSSL in /usr/lib64/python3.4/site-packages Cleaning up...

 I don't know why it wasn't automatically installed, but 'six' is a
 listed dependency of pyOpenSSL. What happens if you try to install
 six?

That gets installed. And then I get:
ImportError: No module named 'cryptography'

So I try to install that. This gives:
Command /usr/bin/python3 -c import setuptools, 
tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize,
 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec')) 
install --record /tmp/pip-_7jexj87-record/install-record.txt 
--single-version-externally-managed --compile failed with error code 1 in 
/tmp/pip_build_root/cryptography
Storing debug log for failure in /root/.pip/pip.log

In the log I see:
c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
 #include Python.h
^

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 14:07 CEST schreef Chris Angelico:

 On Mon, May 4, 2015 at 9:31 PM, Cecil Westerhof ce...@decebal.nl wrote:
 While copying pasting code to test, the following works: [chomp]
 But first I used: with NamedTemporaryFile(mode = 'w', prefix = file
 + '_', dir = filepath, delete = False) as tf: tempfile = tf.name
 with open(real_file, 'r') as f: for line in islice(f, 1, None):
 tf.write(line) rename(tempfile, real_file)

 But that gave:
 File stdin, line 6
 rename(tempfile, real_file)
 ^
 SyntaxError: invalid syntax

 Why?

 To clarify: When you say to test, you mean the interactive
 interpreter, right?

Yes, that is what I mend. Should have been clearer.


 If so, you need to end blocks of text with blank
 lines (and not have any blank lines in between). It's because the
 parser has to know when to run stuff; when you run a script, it
 parses the whole thing and then runs it, but interactively, it has
 to work piece-meal.

OK, thanks: I understand it now.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof ce...@decebal.nl wrote:
 That gets installed. And then I get:
 ImportError: No module named 'cryptography'

 So I try to install that. This gives:
 Command /usr/bin/python3 -c import setuptools, 
 tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize,
  'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec')) 
 install --record /tmp/pip-_7jexj87-record/install-record.txt 
 --single-version-externally-managed --compile failed with error code 1 in 
 /tmp/pip_build_root/cryptography
 Storing debug log for failure in /root/.pip/pip.log

 In the log I see:
 c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
  #include Python.h

Okay, that one's easy enough to deal with!

You have something that needs to build a C extension. To do that, you
need to have the Python headers installed. How did you install Python?
On Debian/Ubuntu family Linuxes, that's probably apt-get install
python3 - so getting the headers would be apt-get install
python3-dev. Give that a try, and then retry the pip install.

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


Re: ImportPython Newsletter

2015-05-04 Thread Alex McFerron
I had the same problem just now

Sent from my iPhone

 On May 3, 2015, at 11:00 AM, Terry Reedy tjre...@udel.edu wrote:
 
 On 5/3/2015 12:01 PM, Ankur Gupta wrote:
 Hey Guys,
 
 Just like to draw attention to ImportPython a weekly Python
 newsletter. This is the 30th issue of the newsletter
 http://importpython.com/newsletter/no/30/.
 
 Nice, but when I tried to subscribe,
 Unable to reach server
 
 -- 
 Terry Jan Reedy
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Peter Otten
Chris Angelico wrote:

 On Mon, May 4, 2015 at 10:01 PM, Peter Otten __pete...@web.de wrote:
 I tried:

 with open(tmp.txt, wb) as f: f.write(alpha\r\nbeta\rgamma\n)
 ...
 f = open(tmp.txt, rU)
 f.newlines
 f.readline()
 'alpha\n'
 f.newlines
 # expected: '\r\n'
 f.readline()
 'beta\n'
 f.newlines
 '\r\n' # expected: ('\r', '\r\n')
 f.readline()
 'gamma\n'
 f.newlines
 ('\r', '\n', '\r\n')

 I believe this is a bug.
 
 I'm not sure it is, actually; imagine the text is coming in one
 character at a time (eg from a pipe), and it's seen alpha\r. It
 knows that this is a line, so it emits it; but until the next
 character is read, it can't know whether it's going to be \r or \r\n.
 What should it do? Read another character, which might block? Put \r
 into .newlines, which might be wrong? Once it sees the \n, it knows
 that it was \r\n (or rather, it assumes that files do not have lines
 of text terminated by \r followed by blank lines terminated by \n -
 because that would be stupid).
 
 It may be worth documenting this limitation, but it's not something
 that can easily be fixed without removing support for \r newlines -
 although that might be an option, given that non-OSX Macs are
 basically history now.

OK, you convinced me. Then I tried:

 with open(tmp.txt, wb) as f: f.write(0\r\n3\r5\n7)
... 
 assert len(open(tmp.txt, rb).read()) == 8
 f = open(tmp.txt, rU)
 f.readline()
'0\n'
 f.newlines
 f.tell()
3
 f.newlines
'\r\n'

Hm, so tell() moves the file pointer? Is that sane?

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


Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 1:17 AM, Peter Otten __pete...@web.de wrote:
 OK, you convinced me. Then I tried:

 with open(tmp.txt, wb) as f: f.write(0\r\n3\r5\n7)
 ...
 assert len(open(tmp.txt, rb).read()) == 8
 f = open(tmp.txt, rU)
 f.readline()
 '0\n'
 f.newlines
 f.tell()
 3
 f.newlines
 '\r\n'

 Hm, so tell() moves the file pointer? Is that sane?

... wow. Okay! That's a bit weird.

It's possible that something's being done with internal buffering
(after all, it's horribly inefficient to *actually* read text one byte
at a time, even if that's what's happening conceptually), and that
tell() causes some checks to be done. But that really is rather
strange. I'd be interested to know what happens if another process
writes to a pipe 0\r, then sleeps while the readline() and tell()
happen, and then writes a \n - what will that do to newlines?

By the way, it's as well to clarify, with all these examples, what
Python version you're using. There may be significant differences.

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


Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Ian Kelly
On Mon, May 4, 2015 at 9:17 AM, Peter Otten __pete...@web.de wrote:
 OK, you convinced me. Then I tried:

 with open(tmp.txt, wb) as f: f.write(0\r\n3\r5\n7)
 ...
 assert len(open(tmp.txt, rb).read()) == 8
 f = open(tmp.txt, rU)
 f.readline()
 '0\n'
 f.newlines
 f.tell()
 3
 f.newlines
 '\r\n'

 Hm, so tell() moves the file pointer? Is that sane?

If I call readline() followed by tell(), I expect the result to be the
position of the start of the next line. Maybe this is considered safe
because tell() on a pipe raises an exception?
-- 
https://mail.python.org/mailman/listinfo/python-list


Bitten by my C/Java experience

2015-05-04 Thread Cecil Westerhof
Potential dangerous bug introduced by programming in Python as if it
was C/Java. :-(
I used:
++tries
that has to be:
tries += 1

Are there other things I have to be careful on? That does not work as
in C/Java, but is correct syntax.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 16:18 CEST schreef Chris Angelico:

 On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof ce...@decebal.nl wrote:
 That gets installed. And then I get:
 ImportError: No module named 'cryptography'

 So I try to install that. This gives: Command /usr/bin/python3 -c
 import setuptools,
 tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize,
 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
 'exec')) install --record
 /tmp/pip-_7jexj87-record/install-record.txt
 --single-version-externally-managed --compile failed with error
 code 1 in /tmp/pip_build_root/cryptography Storing debug log for
 failure in /root/.pip/pip.log

 In the log I see: c/_cffi_backend.c:2:20: fatal error: Python.h: No
 such file or directory #include Python.h

 Okay, that one's easy enough to deal with!

 You have something that needs to build a C extension. To do that,
 you need to have the Python headers installed. How did you install
 Python? On Debian/Ubuntu family Linuxes, that's probably apt-get
 install python3 - so getting the headers would be apt-get install
 python3-dev. Give that a try, and then retry the pip install.

I should have thought about that myself. :-(

Now I get:
c/../_cffi1/ffi_obj.c:489:5: error: ISO C90 forbids mixed declarations and 
code [-Werror=declaration-after-statement]
 PyObject *u = PyUnicode_DecodeLatin1(PyBytes_AS_STRING(res),
 ^
cc1: some warnings being treated as errors

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 1:11 AM, Cecil Westerhof ce...@decebal.nl wrote:
 Now I get:
 c/../_cffi1/ffi_obj.c:489:5: error: ISO C90 forbids mixed declarations 
 and code [-Werror=declaration-after-statement]
  PyObject *u = PyUnicode_DecodeLatin1(PyBytes_AS_STRING(res),
  ^
 cc1: some warnings being treated as errors

Interesting. I'm not sure why yours is complaining about that; mine
doesn't. (Possibly because I'm running Python 3.5, and stuff may have
been changed.) In any case, this would be a reasonable thing to make a
bug report about. In the meantime, you can simply override that
warning-equals-error parameter:

http://stackoverflow.com/questions/25587039/error-compiling-rpy2-on-python3-4-due-to-werror-declaration-after-statement

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


Re: Bitten by my C/Java experience

2015-05-04 Thread Tobiah

On 05/04/2015 08:20 AM, Cecil Westerhof wrote:

Potential dangerous bug introduced by programming in Python as if it
was C/Java. :-(
I used:
 ++tries
that has to be:
 tries += 1

Are there other things I have to be careful on? That does not work as
in C/Java, but is correct syntax.



One surprise for the new user is an otherwise handy rule of scope.
A variable in a function will by default access any global variables of
the same name *unless* it is assigned to in the function.

def glob():
print global:, foo

def loc():
foo = 2
print local:, foo

def alt():
global foo
foo = 1
print altered:, foo

foo = 3

glob()
print Original:, foo

loc()
print Original:, foo

alt()
print Original:, foo

# Output ##

global: 3
Original: 3
local: 2
Original: 3
altered: 1
Original: 1
--
https://mail.python.org/mailman/listinfo/python-list


Re: Bitten by my C/Java experience

2015-05-04 Thread Irmen de Jong
On 4-5-2015 17:20, Cecil Westerhof wrote:
 Potential dangerous bug introduced by programming in Python as if it
 was C/Java. :-(
 I used:
 ++tries
 that has to be:
 tries += 1
 
 Are there other things I have to be careful on? That does not work as
 in C/Java, but is correct syntax.
 

That is a broad question, but one thing that comes to mind is the current 
(python 3)
behavior of integer division. It gives the exact result and doesn't truncate to 
integers:


 5/4
1.25


To be prepared for the future you should probably use python's time machine and 
enable
this behavior for 2.x as well by from __future__ import division.


Another thing is that functions are first class citizens in Python. Java will 
give a
compiler error if you forget to call them and leave out the parentheses (I 
think Java 8
allows it though). Python will accept passing them on as a function object just 
fine. If
you do this by mistake you will probably get an exception a tiny bit down the 
line, at
runtime. But it is syntactically correct so your code will compile without 
error.


-irmen

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


Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Terry Reedy

On 5/4/2015 9:35 AM, Davide Mancusi wrote:

I believe this is a bug.


I'm not sure it is, actually; imagine the text is coming in one
character at a time (eg from a pipe), and it's seen alpha\r. It
knows that this is a line, so it emits it; but until the next
character is read, it can't know whether it's going to be \r or \r\n.
What should it do? Read another character, which might block? Put \r
into .newlines, which might be wrong? Once it sees the \n, it knows
that it was \r\n (or rather, it assumes that files do not have lines
of text terminated by \r followed by blank lines terminated by \n -
because that would be stupid).


I think this is a good point. However, I will probably submit a bug
report anyway and let the devs make their decisions. It is at least a
documentation bug.


Be sure to report the exact python binary you are using, as reported 
when you start the interactive interpreter or Idle shell.


--
Terry Jan Reedy

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


Re: Bitten by my C/Java experience

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 3:32 AM, Irmen de Jong irmen.nos...@xs4all.nl wrote:
 That is a broad question, but one thing that comes to mind is the current 
 (python 3)
 behavior of integer division. It gives the exact result and doesn't truncate 
 to integers:


 5/4
 1.25

Using the word exact around non-integer values can be a little
ambiguous, since floats are often inexact. But yes, int/int - float,
and yes, it WILL bite C programmers.

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


Re: Bitten by my C/Java experience

2015-05-04 Thread Ian Kelly
On Mon, May 4, 2015 at 9:20 AM, Cecil Westerhof ce...@decebal.nl wrote:
 Potential dangerous bug introduced by programming in Python as if it
 was C/Java. :-(
 I used:
 ++tries
 that has to be:
 tries += 1

 Are there other things I have to be careful on? That does not work as
 in C/Java, but is correct syntax.

Some other gotchas that aren't necessarily related to C/Java but can
be surprising nonetheless:

*() is a zero-element tuple, and (a, b) is a two-element tuple,
but (a) is not a one-element tuple. Tuples are created by commas, not
parentheses, so use (a,) instead.

*Default function arguments are created at definition time, not at
call time. So if you do something like:

def foo(a, b=[]):
b.append(a)
print(b)

The b list will be the same list on each call and will retain all
changes from previous calls.

*super() doesn't do what you might expect in multiple inheritance
situations, particularly if you're coming from Java where you never
have to deal with multiple inheritance. It binds to the next class in
the method resolution order, *not* necessarily the immediate
superclass. This also means that the particular class bound to can
vary depending on the specific class of the object.

*[[None] * 8] * 8 doesn't create a 2-dimensional array of None. It
creates one list containing None 8 times, and then it creates a second
list containing the first list 8 times, *not* a list of 8 distinct
lists.

*If some_tuple is a tuple containing a list, then some_tuple[0] +=
['foo'] will concatenate the list *but* will also raise a TypeError
when it tries to reassign the list back to the tuple.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 18:03 CEST schreef Chris Angelico:

 On Tue, May 5, 2015 at 1:11 AM, Cecil Westerhof ce...@decebal.nl wrote:
 Now I get: c/../_cffi1/ffi_obj.c:489:5: error: ISO C90 forbids
 mixed declarations and code [-Werror=declaration-after-statement]
 PyObject *u = PyUnicode_DecodeLatin1(PyBytes_AS_STRING(res), ^ cc1:
 some warnings being treated as errors

 Interesting. I'm not sure why yours is complaining about that; mine
 doesn't. (Possibly because I'm running Python 3.5, and stuff may
 have been changed.) In any case, this would be a reasonable thing to
 make a bug report about. In the meantime, you can simply override
 that warning-equals-error parameter:

 http://stackoverflow.com/questions/25587039/error-compiling-rpy2-on-python3-4-due-to-werror-declaration-after-statement

It looks like I am encircled by Gremlins:
 import urllib3.contrib.pyopenssl
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py, 
line 58, in module
from socket import _fileobject, timeout
ImportError: cannot import name '_fileobject'

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 3:19 AM, Cecil Westerhof ce...@decebal.nl wrote:
 It looks like I am encircled by Gremlins:
  import urllib3.contrib.pyopenssl
 Traceback (most recent call last):
   File stdin, line 1, in module
   File /usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py, 
 line 58, in module
 from socket import _fileobject, timeout
 ImportError: cannot import name '_fileobject'

This is looking like a pyopenssl bug - I can't import that name
either, and given that it has the leading underscore, it's probably
not an official part of the socket module's API.

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


Re: Bitten by my C/Java experience

2015-05-04 Thread Mark Lawrence

On 04/05/2015 16:20, Cecil Westerhof wrote:

Potential dangerous bug introduced by programming in Python as if it
was C/Java. :-(
I used:
 ++tries
that has to be:
 tries += 1

Are there other things I have to be careful on? That does not work as
in C/Java, but is correct syntax.



Not dangerous at all, your test code picks it up.  I'd also guess, but 
don't actually know, that one of the various linter tools could be 
configured to find this problem.


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

Mark Lawrence

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


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Mark Lawrence

On 04/05/2015 16:11, Cecil Westerhof wrote:

Op Monday 4 May 2015 16:18 CEST schreef Chris Angelico:


On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof ce...@decebal.nl wrote:

That gets installed. And then I get:
ImportError: No module named 'cryptography'

So I try to install that. This gives: Command /usr/bin/python3 -c
import setuptools,
tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize,
'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
'exec')) install --record
/tmp/pip-_7jexj87-record/install-record.txt
--single-version-externally-managed --compile failed with error
code 1 in /tmp/pip_build_root/cryptography Storing debug log for
failure in /root/.pip/pip.log

In the log I see: c/_cffi_backend.c:2:20: fatal error: Python.h: No
such file or directory #include Python.h


Okay, that one's easy enough to deal with!

You have something that needs to build a C extension. To do that,
you need to have the Python headers installed. How did you install
Python? On Debian/Ubuntu family Linuxes, that's probably apt-get
install python3 - so getting the headers would be apt-get install
python3-dev. Give that a try, and then retry the pip install.


I should have thought about that myself. :-(



An alternative is to switch to Windows and do away with this archaic 
concept of users having to build code :)


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

Mark Lawrence

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


ANN: Wing IDE 5.1.4 released

2015-05-04 Thread Wingware

Hi,

Wingware has released version 5.1.4 of Wing IDE, our cross-platform 
integrated development environment for the Python programming language.


Wing IDE features a professional code editor with vi, emacs, visual 
studio, and other key bindings, auto-completion, call tips, 
context-sensitive auto-editing, goto-definition, find uses, refactoring, 
a powerful debugger, version control, unit testing, search, project 
management, and many other features.


This release includes the following improvements:

Find Symbol in Project dialog
Support Django 1.8
Support debugging Django with auto-reload enabled
Basic support for Python 3.5 alpha
Change Case operations to Source menu
Fix alignment of monospaced characters on OS X and Linux
Improve pytest support
Fix several code analysis problems
About 40 other bug fixes and improvements

For details see http://wingware.com/news/2015-05-01 and 
http://wingware.com/pub/wingide/5.1.4/CHANGELOG.txt


What's New in Wing 5.1:

Wing IDE 5.1 adds multi-process and child process debugging, syntax 
highlighting in the shells, support for pytest, Find Symbol in Project, 
persistent time-stamped unit test results, auto-conversion of indents on 
paste, an XCode keyboard personality, support for Flask, Django 1.7 and 
1.8, Python 3.5 and recent Google App Engine versions, improved 
auto-completion for PyQt, recursive snippet invocation, and many other 
minor features and improvements.


Free trial: http://wingware.com/wingide/trial
Downloads: http://wingware.com/downloads
Feature list: http://wingware.com/wingide/features
Sales: http://wingware.com/store/purchase
Upgrades: https://wingware.com/store/upgrade

Questions?  Don't hesitate to email us at supp...@wingware.com.

Thanks,

--

Stephan Deibel
Wingware | Python IDE

The Intelligent Development Environment for Python Programmers

wingware.com


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


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Irmen de Jong
On 4-5-2015 19:19, Cecil Westerhof wrote:

 It looks like I am encircled by Gremlins:
  import urllib3.contrib.pyopenssl
 Traceback (most recent call last):
   File stdin, line 1, in module
   File /usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py, 
 line 58, in module
 from socket import _fileobject, timeout
 ImportError: cannot import name '_fileobject'
 

Looks to me as if you have installed a Python 2 version of urllib3? pyopenssl? 
and are
trying to run that under python 3.

(socket module in python 2 does have a _fileobject, whereas in python 3 it no 
longer has
it.  Checked in CPython on Windows.)


Irmen

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


[issue24113] shlex constructor unreachable code

2015-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 395e190ead36 by Raymond Hettinger in branch 'default':
Issue #24113:  Remove unreachable code in shlex.
https://hg.python.org/cpython/rev/395e190ead36

--
nosy: +python-dev

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



[issue24113] shlex constructor unreachable code

2015-05-04 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
priority: normal - low
resolution:  - fixed
status: open - closed

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



[issue24117] Wrong range checking in GB18030 decoder.

2015-05-04 Thread Ma Lin

Ma Lin added the comment:

I found another bug in hz codec.
hz encoding uses 7-bit ASCII to represent Chinese characters, it was popular in 
USENET networks in the late 1980s and early 1990s.

I will do more check and fix them together, then I will invite you to review 
the patch.


u = 'hi~python'
b = u.encode('hz')   # bug in this step, the right sequence should be 
bhi~~python
print(b)# the output is bhi~python

u = b.decode('hz')   # so can't decode, UnicodeDecodeError raised
print(u)

--

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



urllib2.urlopen error socket.error: [Errno 104] Connection reset by peer

2015-05-04 Thread Jia CHEN
Hi There,
 
I have the error below when trying to download the html content of a webpage. I 
can open this webpage in a browser without any problem. I am using Ubuntu 
14.04. Could you give me come clues about what is happening and how to solve 
the issue? Thanks.
 
$python 
 
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
 
[GCC 4.8.2] on linux2
 
Type help, copyright, credits or license for more information.
 
 import urllib2
 
request = 
urllib2.Request('http://guggenheiminvestments.com/products/etf/gsy/holdings')
 
response = urllib2.urlopen(request)
 
  Traceback (most recent call last):
 
File stdin, line 1, in module
 
File /usr/lib/python2.7/urllib2.py, line 127, in urlopen
 
return _opener.open(url, data, timeout)
 
File /usr/lib/python2.7/urllib2.py, line 404, in open
 
response = self._open(req, data)
 
File /usr/lib/python2.7/urllib2.py, line 422, in _open
 
'_open', req)
 
File /usr/lib/python2.7/urllib2.py, line 382, in _call_chain
 
result = func(*args)
 
File /usr/lib/python2.7/urllib2.py, line 1214, in http_open
 
return self.do_open(httplib.HTTPConnection, req)
 
File /usr/lib/python2.7/urllib2.py, line 1187, in do_open
 
r = h.getresponse(buffering=True)
 
File /usr/lib/python2.7/httplib.py, line 1045, in getresponse
 
response.begin()
 
File /usr/lib/python2.7/httplib.py, line 409, in begin
 
version, status, reason = self._read_status()
 
File /usr/lib/python2.7/httplib.py, line 365, in _read_status
 
line = self.fp.readline(_MAXLINE + 1)
 
File /usr/lib/python2.7/socket.py, line 476, in readline
 
data = self._sock.recv(self._rbufsize)
 
socket.error: [Errno 104] Connection reset by peer
 


Best,

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


[issue24113] shlex constructor unreachable code

2015-05-04 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
stage: needs patch - resolved

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



Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Mark Lawrence

On 04/05/2015 09:58, Cecil Westerhof wrote:

But when I do:
 import urllib3.contrib.pyopenssl
I get:
 Traceback (most recent call last):
   File stdin, line 1, in module
   File /usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py, line 55, 
in module
 import OpenSSL.SSL
   File /usr/lib64/python3.4/site-packages/OpenSSL/__init__.py, line 8, in 
module
 from OpenSSL import rand, crypto, SSL
   File /usr/lib64/python3.4/site-packages/OpenSSL/rand.py, line 9, in 
module
 from six import integer_types as _integer_types
 ImportError: No module named 'six'

When I then give:
 pip3 install -U OpenSSL
It goes wrong:
 Could not fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client 
Error: Not Found

I checked and even
 https://pypi.python.org/simple/
does not exist. Anyone an idea what is happening here?



Showing my complete ignorance of *nix, what is the difference betweeen 
/usr/lib/python3.4/... and /usr/lib64/python3.4/...?  Simply 32 
versus 64 bit, which can or can't be mixed, or what?


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

Mark Lawrence

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


[issue24054] Invalid syntax in inspect_fodder2.py (on Python 2.x)

2015-05-04 Thread David D. Riddle

David D. Riddle added the comment:

I have made the changes you suggested. Please tell me if any further changes 
are needed.

 The unclosed file suggests a cleanup bug in linecache which we should
 fix for hygiene, but is separate :)

Should I file a bug report?

--
Added file: http://bugs.python.org/file39291/mywork.patch

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



Re: Bitten by my C/Java experience

2015-05-04 Thread Dave Angel

On 05/04/2015 04:28 PM, Cecil Westerhof wrote:

Op Monday 4 May 2015 21:39 CEST schreef Ian Kelly:


On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:

On 04/05/2015 16:20, Cecil Westerhof wrote:


Potential dangerous bug introduced by programming in Python as if
it was C/Java. :-( I used: ++tries that has to be: tries += 1

Are there other things I have to be careful on? That does not work
as in C/Java, but is correct syntax.



Not dangerous at all, your test code picks it up. I'd also guess,
but don't actually know, that one of the various linter tools could
be configured to find this problem.


pylint reports it as an error.


I installed it. Get a lot of messages. Mostly convention. For example:
 Unnecessary parens after 'print' keyword


Sounds like it's configured for Python 2.x.  There's probably a setting 
to tell it to use Python3 rules.




And:
 Invalid variable name f
for:
 with open(real_file, 'r') as f:


Sounds like a bad wording.  Nothing invalid about it, though it is a bit 
short.  There are certain one letter variables which are so common as to 
be expected, but others should be avoided.





But still something to add to my toolbox.




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


Re: Bitten by my C/Java experience

2015-05-04 Thread Tim Chase
On 2015-05-04 21:57, Andrew Cooper wrote:
 On 04/05/2015 18:43, Ian Kelly wrote:
  
  Some other gotchas that aren't necessarily related to C/Java but
  can be surprising nonetheless:
  
  *() is a zero-element tuple, and (a, b) is a two-element
  tuple, but (a) is not a one-element tuple. Tuples are created by
  commas, not parentheses, so use (a,) instead.
 
 * {} is an empty set(), not dict().
 
 Particularly subtle when combined with **kwargs
 
 $ python3
 Python 3.4.0 (default, Apr 11 2014, 13:05:11)
 [GCC 4.8.2] on linux
 Type help, copyright, credits or license for more
 information.
  def foo(**kwargs):
 ...   return { (k, kwargs[k]) for k in kwargs }
 ...
  foo()
 set()
  foo(a=1)
 {('a', 1)}
 

It's a dict:

Python 3.2.3 (default, Feb 20 2013, 14:44:27) 
[GCC 4.7.2] on linux2
Type help, copyright, credits or license for more information.
 type({})
class 'dict'


What you're seeing is that your generator creates single-element
tuples in a set constructor (note that your last item isn't
{'a': 1}. Try instead

 def foo(**kwargs):
... return {k: kwargs[k] for k in kwargs}
... 
 foo()
{}
 foo(a=42)
{'a': 42}

Note the colons, indicating that it's a dict.  You're using the
dict() syntax:

  dict((k,v) for k,v in some_iter())

-tkc






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


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Irmen de Jong
On 4-5-2015 21:52, Cecil Westerhof wrote:

 But I keep getting the error. Only 2 lines earlier:
  import urllib3.contrib.pyopenssl
 Traceback (most recent call last):
   File stdin, line 1, in module
   File /usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py, 
 line 56, in module
 from socket import _fileobject, timeout
 ImportError: cannot import name '_fileobject'
 

Right. This seems to be an issue with the contrib module pyopenssl that is 
provided as
a courtesy with urllib3. The latter is 100% python 3 compatible from what I 
read in
their docs.

Looking at that contrib module however:
https://github.com/shazow/urllib3/blob/master/urllib3/contrib/pyopenssl.py

In the first few lines in the module docstring it states it is for Python 2.
I guess you won't be able to use this urllib3 contrib module with python 3. 
Maybe you
can contact its author to ask for a fix?


Irmen

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


Re: Bitten by my C/Java experience

2015-05-04 Thread BartC

On 04/05/2015 16:20, Cecil Westerhof wrote:

Potential dangerous bug introduced by programming in Python as if it
was C/Java. :-(
I used:
 ++tries
that has to be:
 tries += 1


I think I've come across that. It doesn't mind ++ so people are likely 
to be assume that increment works as in other languages.


I guess it just means +(+(a)).

But in that case, what meaning does:

a

or

a+b

have in Python? If they were function calls: a() or (a+b)(), then that's 
clear enough. But a+b doesn't do anything!


(I think I would have picked up ++ and -- as special tokens even if 
increment/decrement ops weren't supported. Just because they would 
likely cause errors through misunderstanding.)


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


Re: Bitten by my C/Java experience

2015-05-04 Thread Ian Kelly
On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 04/05/2015 16:20, Cecil Westerhof wrote:

 Potential dangerous bug introduced by programming in Python as if it
 was C/Java. :-(
 I used:
  ++tries
 that has to be:
  tries += 1

 Are there other things I have to be careful on? That does not work as
 in C/Java, but is correct syntax.


 Not dangerous at all, your test code picks it up.  I'd also guess, but don't
 actually know, that one of the various linter tools could be configured to
 find this problem.

pylint reports it as an error.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 20:04 CEST schreef Mark Lawrence:

 An alternative is to switch to Windows and do away with this archaic
 concept of users having to build code :)

Well, maybe I get rid of some problems. But the ones I get back …

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 21:02 CEST schreef Irmen de Jong:

 On 4-5-2015 19:19, Cecil Westerhof wrote:

 It looks like I am encircled by Gremlins:
 import urllib3.contrib.pyopenssl
 Traceback (most recent call last): File stdin, line 1, in
 module File
 /usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py,
 line 58, in module from socket import _fileobject, timeout
 ImportError: cannot import name '_fileobject'


 Looks to me as if you have installed a Python 2 version of urllib3?
 pyopenssl? and are trying to run that under python 3.

 (socket module in python 2 does have a _fileobject, whereas in
 python 3 it no longer has it. Checked in CPython on Windows.)

I did an uninstall and installed it again:
pip3 install urllib3
Downloading/unpacking urllib3
  Downloading urllib3-1.10.4.tar.gz (138kB): 138kB downloaded
  Running setup.py (path:/tmp/pip_build_root/urllib3/setup.py) egg_info for 
package urllib3

warning: no previously-included files matching '*' found under 
directory 'docs/_build'
Installing collected packages: urllib3
  Running setup.py install for urllib3

warning: no previously-included files matching '*' found under 
directory 'docs/_build'
Successfully installed urllib3
Cleaning up...

But I keep getting the error. Only 2 lines earlier:
 import urllib3.contrib.pyopenssl
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py, 
line 56, in module
from socket import _fileobject, timeout
ImportError: cannot import name '_fileobject'

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23865] Fix possible leaks in close methods

2015-05-04 Thread Dmitry Shachnev

Dmitry Shachnev added the comment:

This broke docutils, see issue #24125.

--
nosy: +mitya57

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



Updating FaceBook

2015-05-04 Thread Cecil Westerhof
Using Python to update Twitter is reasonable straight forward.
I do:
from libturpial.api.coreimport Core
from libturpial.exceptions  import StatusDuplicated

I fill an account_id and a message and I do:
Core().update_status(account_id, message)

And my message is posted.

It looks like there is not something like that for FaceBook.  I found:
https://github.com/pythonforfacebook/facebook-sdk
but that looks not easy to implement. Is there an easier way?

In the past you could send an email, but that seems not to work
anymore.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

I don't know why you're bringing up previous versions of Python.  The clinic.py 
under review here is for 3.5.

--

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



Re: Bitten by my C/Java experience

2015-05-04 Thread Andrew Cooper
On 04/05/2015 18:43, Ian Kelly wrote:
 
 Some other gotchas that aren't necessarily related to C/Java but can
 be surprising nonetheless:
 
 *() is a zero-element tuple, and (a, b) is a two-element tuple,
 but (a) is not a one-element tuple. Tuples are created by commas, not
 parentheses, so use (a,) instead.

* {} is an empty set(), not dict().

Particularly subtle when combined with **kwargs

$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type help, copyright, credits or license for more information.
 def foo(**kwargs):
...   return { (k, kwargs[k]) for k in kwargs }
...
 foo()
set()
 foo(a=1)
{('a', 1)}


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


Re: Bitten by my C/Java experience

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 21:39 CEST schreef Ian Kelly:

 On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence breamore...@yahoo.co.uk 
 wrote:
 On 04/05/2015 16:20, Cecil Westerhof wrote:

 Potential dangerous bug introduced by programming in Python as if
 it was C/Java. :-( I used: ++tries that has to be: tries += 1

 Are there other things I have to be careful on? That does not work
 as in C/Java, but is correct syntax.


 Not dangerous at all, your test code picks it up. I'd also guess,
 but don't actually know, that one of the various linter tools could
 be configured to find this problem.

 pylint reports it as an error.

I installed it. Get a lot of messages. Mostly convention. For example:
Unnecessary parens after 'print' keyword

And:
Invalid variable name f
for:
with open(real_file, 'r') as f:

But still something to add to my toolbox.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

The length attribute is an internal implementation detail, so its name is not 
relevant.  It's used in the generation of the accompanying length parameter 
for the impl function for this converter.  length is a good name for it.  
zeroes is not a good name for it.  zeroes is, however, a decent name for 
the converter parameter.

I have no quarrel with the documentation using the term NUL.  But I don't think 
the term translates well to use parameter names.

--

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



[issue24000] More fixes for the Clinic mapping of converters to format units

2015-05-04 Thread Larry Hastings

Larry Hastings added the comment:

As for why not length instead of zeroes: Because the primary reason for the 
parameter is specifying that the string can contain embedded zeroes.  Returning 
the length is a side-effect of this, not the main point.  If the string didn't 
have embedded zeroes, we wouldn't need the length.

The only reason the code didn't have zeroes=True everywhere was because I 
screwed up and didn't realize all those mappings *should* have specified it.

The documentation is very consistent about calling it a NUL.  I don't think 
NUL=True or allow_NUL=true is particularly attractive; we never (almost 
never?) use capital letters in parameter names.  So any other name is going to 
be a compromise.  allow_null and allow_nul are misspellings, and don't 
convey the idea any better; they can confuse the reader with the related 
concept of NULL or None.  At least zeroes has the benefit of being an actual 
word, representing a related concept.

Will you be done bikeshedding soon?

--

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



Re: Why from en to two times with sending email

2015-05-04 Thread Ian Kelly
On Mon, May 4, 2015 at 12:59 PM, Cecil Westerhof ce...@decebal.nl wrote:
 I want to change an old Bash script to Python. When I look at:
 https://docs.python.org/2/library/email-examples.html

 Then from and to have to be used two times? Why is that?

Once to construct the message headers, and once to instruct the SMTP
server where to send the message. These are not required to agree; for
instance, bcc recipients need to be supplied to the server but aren't
included in the headers.
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >