[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Jan-Philip Gehrcke

Changes by Jan-Philip Gehrcke jgehr...@gmail.com:


Added file: http://bugs.python.org/file37988/issue6634_py35.patch

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



[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Jan-Philip Gehrcke

Changes by Jan-Philip Gehrcke jgehr...@gmail.com:


Removed file: http://bugs.python.org/file37986/issue6634_py35.patch

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



[issue23380] Python 2.7.9 test_gdb fails on Fedora 21

2015-02-02 Thread STINNER Victor

STINNER Victor added the comment:

I'm using Fedora 21 with gdb 7.8.2-38.fc21 on x86_64. With the development 2.7 
branch, test_gdb pass here. How did you get Python 2.7.9? What is your gdb 
version?

--
nosy: +haypo

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread Stefan Krah

Stefan Krah added the comment:

Ah yes, it seems to originate from #3139.

--

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



Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Gabriel Ferreira
The original plan was doing it using python. But, anyway, I should build a 
robot program to do that task for me... Because I need to capture hundreds of 
hours of different videos... You mean that is difficult because it's Python... 
or it's difficult because it's a Flash Application?

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


[issue5945] PyMapping_Check returns 1 for lists

2015-02-02 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
versions: +Python 3.5 -Python 3.2, Python 3.3

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



[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Jan-Philip Gehrcke

Changes by Jan-Philip Gehrcke jgehr...@gmail.com:


Removed file: http://bugs.python.org/file19006/thread_sys_exit_test.py

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



Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Irmen de Jong
On 2-2-2015 20:30, Gabriel Ferreira wrote:
 Hi Paul, I presume the stream operator doesn't want to prevent me from 
 downloading or recording the videos. I just wanna know more about some lib 
 that could be used to deal with Flash Player Applications... Or possibly, 
 anything that could lead me to be able to get those streaming videos.
 
 Thx
 


Right, have you tried VLC then? (unless you really want to do this from 
python...)
VLC can play streams, probably yours too, and convert it to another file.

Irmen

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


[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread Stefan Krah

Stefan Krah added the comment:

Well, here's a patch with tests.

Victor, I think you added the contiguity test in 9d49b744078c. Do you
remember why?

--
Added file: http://bugs.python.org/file37987/issue23376-2.diff

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



[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Jan-Philip Gehrcke

Jan-Philip Gehrcke added the comment:

For Python 3.5, I have attached a patch that 

- adds relevant test cases to test_threading.py which probe
  the interpreter's stderr output for compliance with what
  the docs state.

- makes sys.exit(msg) write msg to stderr, even if called
  from a non-primary thread, so that the tests succeed.

If we take this path, the documentation for 3.5 does not need to be adjusted.

The discussion in this thread diversified itself a bit:

 Why don't threads have their own ThreadExit exception,
 rather than overloading the use, and therefore, the 
 meaning, of the SystemExit exception? sys.exit and the
 SystemExit exception should *only* be used to exit the
 entire system, not just a thread!

While I absolutely agree that this would be conceptually cleaner, implementing 
this would be a larger refactoring task. Deciding whether this should be done 
or not slows this issue down, and I think this discussion should probably be 
taken elsewhere.

--
versions: +Python 3.5 -Python 3.1, Python 3.2
Added file: http://bugs.python.org/file37986/issue6634_py35.patch

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



Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Michael Torrie
On 02/02/2015 12:30 PM, Gabriel Ferreira wrote:
 Hi Paul, I presume the stream operator doesn't want to prevent me
 from downloading or recording the videos. I just wanna know more
 about some lib that could be used to deal with Flash Player
 Applications... Or possibly, anything that could lead me to be able
 to get those streaming videos.

You can't do it directly with any Python library that I know of.  You
can, however, use the tools that come with rtmpdump:

https://rtmpdump.mplayerhq.hu/

It's not automatic, and requires some iptables tricks, but once you get
the stream information, you can always download it via rtmpdump.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Paul Rubin
Gabriel Ferreira gabrielbianchiferre...@gmail.com writes:
 Hi Paul, I presume the stream operator doesn't want to prevent me from
 downloading or recording the videos.  

It's hard to tell why anyone uses Flash anymore, but impeding (if not
preventing) downloads is probably a common reason.

 I just wanna know more about some lib that could be used to deal with
 Flash Player Applications... Or possibly, anything that could lead me
 to be able to get those streaming videos.

Gnash maybe?  https://www.gnu.org/software/gnash/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23285] PEP 475 - EINTR handling

2015-02-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

PEP is now updated.

--

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



[issue23351] socket.settimeout(5.0) does not have any effect

2015-02-02 Thread Charles-François Natali

Changes by Charles-François Natali cf.nat...@gmail.com:


--
status: open - pending

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread STINNER Victor

STINNER Victor added the comment:

 Victor, I think you added the contiguity test in 9d49b744078c. Do you
remember why?

I don't understand the change like that. The call to 
PyBuffer_IsContiguous(view, 'C') was older than this changeset.

--

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



[issue23357] pyvenv help shows incorrect usage

2015-02-02 Thread Raúl Cumplido

Raúl Cumplido added the comment:

From your question, yes I have completed the form.
I've added a new patch just with the documentation change and changing the 
output from the help command as it was wrong. If it doesn't make sense do let 
me know. I've done it from 3.4

--
Added file: http://bugs.python.org/file37985/23357.3.patch

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



Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Mark Lawrence

On 02/02/2015 22:09, Gabriel Ferreira wrote:

The original plan was doing it using python. But, anyway, I should build a 
robot program to do that task for me... Because I need to capture hundreds of 
hours of different videos... You mean that is difficult because it's Python... 
or it's difficult because it's a Flash Application?

Thx



I don't actually know, but could you please provide some context and 
write in plain English, those damn ... things are extremely annoying.


--
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: Downloading videos (in flash applications) using python

2015-02-02 Thread Gabriel Ferreira
Hi Paul, I presume the stream operator doesn't want to prevent me from 
downloading or recording the videos. I just wanna know more about some lib that 
could be used to deal with Flash Player Applications... Or possibly, anything 
that could lead me to be able to get those streaming videos.

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


[issue2292] Missing *-unpacking generalizations

2015-02-02 Thread Joshua Landau

Joshua Landau added the comment:

I don't know the etiquette rules for the issue tracker, but I'd really 
appreciate having something to debug -- it's working for me, you see.

--

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



[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Jan-Philip Gehrcke

Changes by Jan-Philip Gehrcke jgehr...@gmail.com:


Removed file: http://bugs.python.org/file37988/issue6634_py35.patch

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



[issue23342] run() - unified high-level interface for subprocess

2015-02-02 Thread Thomas Kluyver

Thomas Kluyver added the comment:

Third version of the patch (subprocess_run3):

- Simplifies the documentation of the trio (call, check_call, check_output) to 
describe them in terms of the equivalent run() call.
- Remove a warning about using PIPE with check_output - I believe this was 
already incorrect, since check_output uses .communicate() internally, it 
shouldn't have deadlock issues.
- Replace the implementation of check_output() with a call to run().

I didn't reimplement call or check_call - as previously discussed, they are 
more different from the code in run(), so subtly breaking things is more 
possible. They are also simpler.

--
Added file: http://bugs.python.org/file37991/subprocess_run3.patch

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



[issue2292] Missing *-unpacking generalizations

2015-02-02 Thread Ethan Furman

Ethan Furman added the comment:

Thanks, Terry!  I'll do that next time -- after I make sure and re-compile.  :/

--

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



[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Jan-Philip Gehrcke

Changes by Jan-Philip Gehrcke jgehr...@gmail.com:


Removed file: http://bugs.python.org/file37983/issue6634_py27.patch

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



[issue23380] Python 2.7.9 test_gdb fails on Fedora 21

2015-02-02 Thread Vinson Lee

Vinson Lee added the comment:

I downloaded Python 2.7.9 release tarball from 
https://www.python.org/downloads/release/python-279.

$ gdb --version
GNU gdb (GDB) Fedora 7.8.2-38.fc21
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as x86_64-redhat-linux-gnu.
Type show configuration for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type help.
Type apropos word to search for commands related to word.

--

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



[issue19542] WeakValueDictionary bug in setdefault()pop()

2015-02-02 Thread Armin Rigo

Armin Rigo added the comment:

Converted the test into an official test, which fails; and wrote the patch for 
CPython 3.trunk and for CPython 2.7.  Please review and commit.

--
keywords: +needs review -patch
stage: needs patch - patch review

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



[issue2292] Missing *-unpacking generalizations

2015-02-02 Thread Ethan Furman

Ethan Furman added the comment:

Argh -- I applied the patch, but didn't recompile.  Doing that now...

--

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



[issue23369] integer overflow in _json.encode_basestring_ascii

2015-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5c730d30ffbc by Benjamin Peterson in branch '3.3':
reduce memory usage of test (closes #23369)
https://hg.python.org/cpython/rev/5c730d30ffbc

--
status: open - closed

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



[issue23366] integer overflow in itertools.combinations

2015-02-02 Thread Benjamin Peterson

Benjamin Peterson added the comment:

lgtm

--
nosy: +benjamin.peterson

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



[issue23365] integer overflow in itertools.combinations_with_replacement

2015-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 356ed025dbae by Serhiy Storchaka in branch '3.3':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/356ed025dbae

New changeset 98c720c3e061 by Serhiy Storchaka in branch '3.4':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/98c720c3e061

New changeset 4cb316fe6bf2 by Serhiy Storchaka in branch 'default':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/4cb316fe6bf2

--

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



[issue23381] Python 2.7.9+ test_gdb regression on Ubuntu 10.04

2015-02-02 Thread Vinson Lee

New submission from Vinson Lee:

Python 2.7.9+ test_gdb regressed on Ubuntu 10.04.

063d966b78f0c0b7cf4c937991bf883c563f574e is the first bad commit
commit 063d966b78f0c0b7cf4c937991bf883c563f574e
Author: Serhiy Storchaka storch...@gmail.com
Date:   Sat Jan 31 11:48:36 2015 +0200

Issue #22765: Fixed test_gdb failures. Supressed unexpected gdb output.
Patch by Bohuslav Kabrda.

:04 04 dd420a96366b568ad8ae5e7c88759d743b29584c 
0eb56f3c2d8d731985ae93258170e00571ae9a35 M  Lib
bisect run success


$ gdb --version
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as x86_64-linux-gnu.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.


$ ./python Lib/test/regrtest.py -v test_gdb
== CPython 2.7.9+ (default, Feb 2 2015, 15:48:27) [GCC 4.4.3]
==   Linux-2.6.32-71-generic-x86_64-with-debian-squeeze-sid little-endian
==   cpython/build/test_python_29238
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, 
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, 
unicode=0, bytes_warning=0, hash_randomization=0)
[1/1] test_gdb
test_NULL_instance_dict (test.test_gdb.PrettyPrintTests)
Ensure that a PyInstanceObject with with a NULL in_dict is handled ... FAIL
test_NULL_ob_type (test.test_gdb.PrettyPrintTests)
Ensure that a PyObject* with NULL ob_type is handled gracefully ... FAIL
test_NULL_ptr (test.test_gdb.PrettyPrintTests)
Ensure that a NULL PyObject* is handled gracefully ... FAIL
test_builtin_function (test.test_gdb.PrettyPrintTests) ... FAIL
test_builtin_method (test.test_gdb.PrettyPrintTests) ... FAIL
test_builtins_help (test.test_gdb.PrettyPrintTests)
Ensure that the new-style class _Helper in site.py can be handled ... FAIL
test_classic_class (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of classic class instances ... FAIL
test_corrupt_ob_type (test.test_gdb.PrettyPrintTests)
Ensure that a PyObject* with a corrupt ob_type is handled gracefully ... FAIL
test_corrupt_tp_flags (test.test_gdb.PrettyPrintTests)
Ensure that a PyObject* with a type with corrupt tp_flags is handled ... FAIL
test_corrupt_tp_name (test.test_gdb.PrettyPrintTests)
Ensure that a PyObject* with a type with corrupt tp_name is handled ... FAIL
test_dicts (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of dictionaries ... FAIL
test_exceptions (test.test_gdb.PrettyPrintTests) ... FAIL
test_frames (test.test_gdb.PrettyPrintTests) ... FAIL
test_frozensets (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of frozensets ... FAIL
test_getting_backtrace (test.test_gdb.PrettyPrintTests) ... FAIL
test_int (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of various int values ... FAIL
test_lists (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of lists ... FAIL
test_long (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of various long values ... FAIL
test_modern_class (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of new-style class instances ... FAIL
test_selfreferential_dict (test.test_gdb.PrettyPrintTests)
Ensure that a reference loop involving a dict doesn't lead proxyval ... FAIL
test_selfreferential_list (test.test_gdb.PrettyPrintTests)
Ensure that a reference loop involving a list doesn't lead proxyval ... FAIL
test_selfreferential_new_style_instance (test.test_gdb.PrettyPrintTests) ... 
FAIL
test_selfreferential_old_style_instance (test.test_gdb.PrettyPrintTests) ... 
FAIL
test_sets (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of sets ... FAIL
test_singletons (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of True, False and None ... FAIL
test_strings (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of strings ... FAIL
test_subclassing_list (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of an instance of a list subclass ... FAIL
test_subclassing_tuple (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of an instance of a tuple subclass ... FAIL
test_truncation (test.test_gdb.PrettyPrintTests)
Verify that very long output is truncated ... FAIL
test_tuples (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of tuples ... FAIL
test_unicode (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of unicode values ... FAIL
test_basic_command (test.test_gdb.PyListTests)
Verify that the py-list command works ... skipped 'Python was compiled with 
optimizations'
test_one_abs_arg (test.test_gdb.PyListTests)
Verify the py-list command with one absolute argument ... skipped 'Python was 
compiled with optimizations'
test_two_abs_args 

[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Martin Panter

Martin Panter added the comment:

New patches look fine. BTW SystemExit.code is also documented at 
https://docs.python.org/dev/library/exceptions.html#SystemExit.

--

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



Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Steven D'Aprano
Paul Rubin wrote:

 It's hard to tell why anyone uses Flash anymore

Masochism and/or sadism, depending on whether they get more pain from
writing the Flash code in the first place or pleasure from forcing Flash on
the viewer.



-- 
Steven

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


[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Jan-Philip Gehrcke

Jan-Philip Gehrcke added the comment:

 Regarding the documentation patch: I like to start sentences
 with a capital letter. Perhaps change it to start
 “Calling :func:`exit` only terminates . . .”.

Thanks for feedback. Have now used Invocation of  to not repeat call* 
in the sentence, because I left the when called from the main thread part 
unchanged. Okay?

 With the code change patch, it might be neater to use
 the SystemExit.code attribute rather than e.args[0].

Oh, thanks. Was not aware of the existence of the `code` attribute. If anyone 
else was wondering: existence and behavior are defined in Objects/exceptions.c 
via `static PyMemberDef SystemExit_members[]` and via `static int 
SystemExit_init()`.

It is populated upon construction of a SystemExit instance:

Py_CLEAR(self-code);
if (size == 1)
self-code = PyTuple_GET_ITEM(args, 0);
else /* size  1 */
self-code = args;

Hence, the translation from arguments to exit code considers *all* arguments. I 
adjusted the patch to use the `code` attribute.

--
Added file: http://bugs.python.org/file37989/issue6634_py35.patch

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



[issue2292] Missing *-unpacking generalizations

2015-02-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Upload a .txt file if there is really too much for a message.

--

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



Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Gabriel Ferreira
Mark Lawrence  wrote:

 I don't actually know, but could you please provide some context and 
 write in plain English, those damn ... things are extremely annoying.
 

Hi, Mark. 

I am developing a research project, which includes video analysis (computer 
vision, big data, data mining, etc). The first part of the project is about 
building a database containing a big amount of video of urban zones. I live in 
Brazil, so the plan is collecting videos from urban areas of Brazilian big 
cities, like Sao Paulo. 

I have to make this task automatic. in other words, I don't want to manually 
download hundreds or thousands hours of videos. So I have to develop a robot 
to do that assingment for me. (I wish I could do that using Python).

I have found a good website that provides me live images from several cities in 
Brazil. So that's it! That's what I need. I was expecting to develop a program 
to record  download those videos, that are being broadcasted live on that 
website. So I would be able to form my database and continue my research.

The problem is that this particular website uses a flash player application do 
broadcast the live images of the urban areas. I'm not too familiar with Flash 
Applications. I don't know how to deal with them using Python. I was wondering 
if someone could help me solve this problem. The goal is recording  
downloading those videos, from the mentioned website. And, yes, it has to be an 
automated program (no manual work).

I wish I had been clear with you guys!

THX!

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


[issue23380] Python 2.7.9 test_gdb fails on Fedora 21

2015-02-02 Thread Vinson Lee

Vinson Lee added the comment:

Python 2.7.9+ test_gdb passes on Fedora 21 with the latest 2.7 branch.

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

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



[issue6634] sys.exit() called from threads other than the main one: undocumented behaviour

2015-02-02 Thread Jan-Philip Gehrcke

Changes by Jan-Philip Gehrcke jgehr...@gmail.com:


Added file: http://bugs.python.org/file37990/issue6634_py27.patch

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



Re: [OT] fortran lib which provide python like data type

2015-02-02 Thread Chris Angelico
On Tue, Feb 3, 2015 at 5:34 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 02/02/2015 17:25, Chris Angelico wrote:

 On Tue, Feb 3, 2015 at 3:52 AM, Mark Lawrence breamore...@yahoo.co.uk
 wrote:

 I'd like to see anybody define 'a' and 'the' without using 'a' and 'the'.
 Would that be formally rigorous or rigorously formal?


 a: Indefinite article, used to represent individual objects not
 otherwise identifiable.

 Near enough?


 Nope.  'article' begins with 'a' so you can't use it to define itself.

Hrm. This is difficult.

a: Indefinite identifier, used to represent non-specific objects.

Not a perfectly accurate definition now, but hey, I avoided the self-reference!

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


[issue19542] WeakValueDictionary bug in setdefault()pop()

2015-02-02 Thread Armin Rigo

Changes by Armin Rigo ar...@users.sourceforge.net:


Added file: http://bugs.python.org/file37993/fix-weakvaluedict-2.7.diff

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



[issue19542] WeakValueDictionary bug in setdefault()pop()

2015-02-02 Thread Armin Rigo

Changes by Armin Rigo ar...@users.sourceforge.net:


--
keywords: +patch
Added file: http://bugs.python.org/file37992/fix-weakvaluedict.diff

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1da9630e9b7f by Serhiy Storchaka in branch '3.4':
Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
https://hg.python.org/cpython/rev/1da9630e9b7f

New changeset 2e684ce772de by Serhiy Storchaka in branch 'default':
Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
https://hg.python.org/cpython/rev/2e684ce772de

New changeset 0024537a4687 by Serhiy Storchaka in branch 'default':
Issue #22896: Fixed using _getbuffer() in recently added _PyBytes_Format().
https://hg.python.org/cpython/rev/0024537a4687

--
nosy: +python-dev

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



[issue23099] BytesIO and StringIO values unavailable when closed

2015-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e62d54128bd3 by Serhiy Storchaka in branch '3.4':
Issue #23099: Closing io.BytesIO with exported buffer is rejected now to
https://hg.python.org/cpython/rev/e62d54128bd3

--
nosy: +python-dev

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



[issue23363] integer overflow in itertools.permutations

2015-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 356ed025dbae by Serhiy Storchaka in branch '3.3':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/356ed025dbae

New changeset 98c720c3e061 by Serhiy Storchaka in branch '3.4':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/98c720c3e061

New changeset 4cb316fe6bf2 by Serhiy Storchaka in branch 'default':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/4cb316fe6bf2

--

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



[issue23366] integer overflow in itertools.combinations

2015-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 356ed025dbae by Serhiy Storchaka in branch '3.3':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/356ed025dbae

New changeset 98c720c3e061 by Serhiy Storchaka in branch '3.4':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/98c720c3e061

New changeset 4cb316fe6bf2 by Serhiy Storchaka in branch 'default':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/4cb316fe6bf2

--

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



[issue23364] integer overflow in itertools.product

2015-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 356ed025dbae by Serhiy Storchaka in branch '3.3':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/356ed025dbae

New changeset 98c720c3e061 by Serhiy Storchaka in branch '3.4':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/98c720c3e061

New changeset 4cb316fe6bf2 by Serhiy Storchaka in branch 'default':
Issues #23363, #23364, #23365, #23366: Fixed itertools overflow tests.
https://hg.python.org/cpython/rev/4cb316fe6bf2

--

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread STINNER Victor

STINNER Victor added the comment:

Do you have unit test with non contiguous buffers? If not, it would help to 
have such buffer in _testcapi.

--
nosy: +haypo

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread Stefan Krah

Stefan Krah added the comment:

Yes, _testbuffer.ndarray can create any buffer.

--

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread STINNER Victor

STINNER Victor added the comment:

 Yes, _testbuffer.ndarray can create any buffer.

Cool. So could you please add non regression tests to test_w_star() of 
test_getargs2?

Other formats expect a contiguous buffer: 'y*', 's*', 'z*'. 
Formats which convert a buffer: 'y', 's#', 'z#.

--

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread Stefan Krah

Stefan Krah added the comment:

A unit test would not be so helpful. The potential problem is that
third party extensions with broken getbufferprocs would suffer.


But at some point we have to streamline PEP-3118 code, or it
will remain inscrutable forever.  Extension writers often copy
code from cpython, and I'm afraid if we don't remove redundancy,
people will think such contiguity checks are necessary.

--

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-02-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In any case we need a hack in 3.4. Let open new issue for adding 
PyMemoryView_FromObjectEx() or like.

--

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



Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Steven D'Aprano
Devin Jeanpierre wrote:

 Oops, I just realized why such a claim might be made: the
 documentation probably wants to be able to say that any method can use
 super(). So that's why it claims that it isn't a method unless it's
 defined inside a class body.


You can use super anywhere, including outside of classes. The only thing you
can't do is use the Python 3 super hack which automatically fills in the
arguments to super if you don't supply them. That is compiler magic which
truly does require the function to be defined inside a class body. But you
can use super outside of classes:


py class A(list):
... pass
...
py x = super(A)  # Unbound super object!
py x.__get__(A).append
method 'append' of 'list' objects
py a = A()
py x.__get__(a).append
built-in method append of A object at 0xb7b8beb4



-- 
Steven

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


[issue23357] pyvenv help shows incorrect usage

2015-02-02 Thread STINNER Victor

STINNER Victor added the comment:

 Added tests (hope is what you expect) and changed some bits on the test file 
 to be pep8 comliant.

Nooo, please don't change two things in same patch: open a new issue for your 
PEP 8 changes.

--

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



Re: Python is DOOMED! Again!

2015-02-02 Thread Rustom Mody
On Monday, February 2, 2015 at 1:13:30 PM UTC+5:30, Paul Rubin wrote:
 Steven D'Aprano writes:
  No apples and no oranges aren't the same thing, but if somebody is 
  expecting 
  no apples, and I give them no oranges instead, it would be churlish for 
  them 
  to complain that none of them are the wrong kind of fruit.
 
 https://davedevine.wordpress.com/2011/01/20/the-sartre-joke/

Actually the Sartre joke is more applicable to haskell than it might appear at 
first blush.

li = [1,2,3] : [Int] -- a monomorphic type
just as
lc = ['a','b','c'] : [Char]
lli = [[1,2],[3]] : [[Int]]

However [] is a polymorphic value ie
[] : [t]   -- t is a type variable

And now if we take
tail (tail (tail li)) 
you get []
just as if you take
tail (tail lli)

However the two '[]-s' are of different types
and so if you try to say append them you will get a Sartre error:

The list of no integers is incompatible with the list of no lists of integers
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread Stefan Krah

New submission from Stefan Krah:

The call to PyBuffer_IsContiguous() (see patch) is redundant:

PyBUF_WRITABLE is a flag that can be added to any buffer request.
The real request here is (PyBUF_SIMPLE|PyBUF_WRITABLE), which is
equal to PyBUF_WRITABLE since PyBUF_SIMPLE==0.

PyBUF_SIMPLE implies C-contiguous with format 'B'.


Perhaps the check was added for broken buffer providers, but I
think at some point we should assume correct providers.

--
keywords: +patch
nosy: +larry
Added file: http://bugs.python.org/file37976/issue23376.diff

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



Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Devin Jeanpierre
On Mon, Feb 2, 2015 at 4:06 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Sun, Feb 1, 2015 at 11:15 PM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 Both K.f and K.g are methods, even though only one meets the definition
 given in the glossary. The glossary is wrong.

I agree, it oversimplified and has made a useless distinction here.

 Even if it is so defined, the definition is wrong. You can define methods
 on an instance. I showed an example of an instance with its own personal
 __dir__ method, and showed that dir() ignores it if the instance belongs
 to a new-style class but uses it if it is an old-style class.

 You didn't define a method, you defined a callable attribute.

 That is wrong. I defined a method:

 py from types import MethodType
 py type(instance.f) is MethodType
 True


 instance.f is a method by the glossary definition. Its type is identical to
 types.MethodType, which is what I used to create a method by hand.

You are assuming that they are both methods, just because they are
instances of a type called MethodType. This is like assuming that a
Tree() object is made out of wood.

The documentation is free to define things in terms other than types
and be correct. There are many properties of functions-on-classes that
callable instance attributes that are instances of MethodType do not
have, as we've already noticed. isinstance can say one thing, and the
documentation another, and both can be right, because they are saying
different things.


For an example we can all agree on, this is not an instance of
collections.Iterable, but the docs claim it is iterable:
https://docs.python.org/2/glossary.html#term-iterable

class MyIterable(object):
def __getitem__(self, i): return i

The docs are not wrong, they are just making a distinction for
humans that is separate from the python types involved. This is OK.

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


Re: [OT] fortran lib which provide python like data type

2015-02-02 Thread beliavsky
On Friday, January 30, 2015 at 5:51:38 PM UTC-5, Gregory Ewing wrote:
 Michael Torrie wrote:
  On 01/30/2015 10:31 AM, Rustom Mody wrote:
  
 And what about the grey area between lightweight and heavyweight?
  
  That's what the smart pointers are for.
 
 I'd say it's what higher-level languages are for. :-)
 
 I'm completely convinced nowadays that there is
 *no* use case for C++. If you need to program the
 bare metal, use C. For anything more complicated,
 use a language that has proper memory-management
 abstractions built in.

Lots of people are using C++ to build packages for statistical programming 
language R, using the package Rcpp. It has been possible to build such packages 
for R and S using Fortran and C since the beginning, and many have done so, but 
the wide usage of Rcpp suggests that there are advantages to using C++. C++ is 
still the primary language used by financial derivatives quants.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue13322] buffered read() and write() does not raise BlockingIOError

2015-02-02 Thread Martin Panter

Martin Panter added the comment:

Looking at test_io.BufferedReaderTest.test_read_non_blocking(), at 
Lib/test/test_io.py:1037, there are explicit tests for ‘peek(1) == b ’ and 
‘read() is None’. The peek() test was added in revision 3049ac17e256, in 2009 
(large merge of “io” implementation in C; can’t find more detailed history). 
The read() test was added in revision 21233c2e5d09 in 2007, with a remark about 
a “tentative decision to drop nonblocking I/O support from the buffering 
layers”.

My suggestion is to make the read/into/1/all/peek() methods all return None if 
no non-blocking data is available, and return a short non-empty result if some 
data was available but not enough to satisfy the equivalent blocking call. 
However, this would invove changing the behaviour of BufferedReader.read1() and 
peek(); would that be allowed?

The readline() based methods could probably work similarly, but that would be 
another issue and a bigger change, because the equivalent RawIOBase methods do 
not return None.

--

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think memoryview(bytearray)[::2] provides non contiguous buffers. But I'm not 
sure this is tested.

--
nosy: +serhiy.storchaka

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



Is there a cairo like surface for the screen without the window hassle

2015-02-02 Thread Antoon Pardon
I need to have a program construct a number of designs. Of course I can directly
use a pfd surface and later use a pdf viewer to check. But that becomes rather
cumbersome fast. But if I use a cairo-surface for on the screen I suddenly have
to cope with expose events and all such things I am not really interested in.

So does someone know of a package that provides a cairo like surface but that
would take care of the events in a rather straight forward matter, so that my
program could make it's design in a window on the screen just as if it is
designing it in a pdf file.

-- 
Antoon Pardon

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


[issue23378] argparse.add_argument action parameter should allow value extend

2015-02-02 Thread the mulhern

New submission from the mulhern:

As well as the append action it would be convenient for there to be an extend 
action.

This is kind of useful to allow something like:

parser.add_argument(--foo, action=extend, nargs=+, type=str)

given

parser.parse_args(--foo f1 --foo f2 f3 f4.split())

to result in

[f1, f2, f3, f4].

The action append results in

[[f1], [f2, f3, f4]]

And action store in

[f2, f3, f4].

It is easy to write a custom action, but it feels like a fairly common 
requirement.

Probably it would make sense to extend the default, similarly to how append 
behaves.

--
components: Library (Lib)
messages: 235260
nosy: the.mulhern
priority: normal
severity: normal
status: open
title: argparse.add_argument action parameter should allow value extend
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6

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



Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Steven D'Aprano
Rustom Mody wrote:

 My point was more methodological/sociological than technical:
 
 Are these dunder methods as 'internal' as say the register-allocation used
 by a C compiler?


Dunder methods are implementation, not interface. If you are the class
author, then you care about the implementation, and write dunder methods.
But as the class user, you should not call dunder methods directly, instead
always go through the public interface:

# Not these.
a.__dir__()
seq.__len__()
x.__add__(y)
spam.__eq__(ham)

# Use these
dir(a)
len(seq)
x + y
spam == ham



-- 
Steven

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


Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Devin Jeanpierre
On Mon, Feb 2, 2015 at 5:00 AM, Devin Jeanpierre jeanpierr...@gmail.com wrote:
 On Mon, Feb 2, 2015 at 4:06 AM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 On Sun, Feb 1, 2015 at 11:15 PM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 Both K.f and K.g are methods, even though only one meets the definition
 given in the glossary. The glossary is wrong.

 I agree, it oversimplified and has made a useless distinction here.

Oops, I just realized why such a claim might be made: the
documentation probably wants to be able to say that any method can use
super(). So that's why it claims that it isn't a method unless it's
defined inside a class body.

-- Devin

 Even if it is so defined, the definition is wrong. You can define methods
 on an instance. I showed an example of an instance with its own personal
 __dir__ method, and showed that dir() ignores it if the instance belongs
 to a new-style class but uses it if it is an old-style class.

 You didn't define a method, you defined a callable attribute.

 That is wrong. I defined a method:

 py from types import MethodType
 py type(instance.f) is MethodType
 True


 instance.f is a method by the glossary definition. Its type is identical to
 types.MethodType, which is what I used to create a method by hand.

 You are assuming that they are both methods, just because they are
 instances of a type called MethodType. This is like assuming that a
 Tree() object is made out of wood.

 The documentation is free to define things in terms other than types
 and be correct. There are many properties of functions-on-classes that
 callable instance attributes that are instances of MethodType do not
 have, as we've already noticed. isinstance can say one thing, and the
 documentation another, and both can be right, because they are saying
 different things.


 For an example we can all agree on, this is not an instance of
 collections.Iterable, but the docs claim it is iterable:
 https://docs.python.org/2/glossary.html#term-iterable

 class MyIterable(object):
 def __getitem__(self, i): return i

 The docs are not wrong, they are just making a distinction for
 humans that is separate from the python types involved. This is OK.

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


[issue10910] pyport.h FreeBSD/Mac OS X fix causes errors in C++ compilation

2015-02-02 Thread koobs

Changes by koobs koobs.free...@gmail.com:


--
nosy: +koobs

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



[issue23369] integer overflow in _json.encode_basestring_ascii

2015-02-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

\u*((2**32)//6 + 1) is calculated at compile time. This requires much 
memory and can cause swapping. May be this was a cause of failing tests on some 
buildbots:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%203.x/builds/2623/steps/test/logs/stdio
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%203.4/builds/749/steps/test/logs/stdio

Traceback (most recent call last):
  File /usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/runpy.py, line 
170, in _run_module_as_main
__main__, mod_spec)
  File /usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/runpy.py, line 
85, in _run_code
exec(code, run_globals)
  File 
/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/test/__main__.py, line 
3, in module
regrtest.main_in_temp_cwd()
  File 
/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/test/regrtest.py, line 
1564, in main_in_temp_cwd
main()
  File 
/usr/home/buildbot/python/3.4.koobs-freebsd9/build/Lib/test/regrtest.py, line 
738, in main
raise Exception(Child error on {}: {}.format(test, result[1]))
Exception: Child error on test_json: Exit code -9
*** [buildbottest] Error code 1

At least my computer hanged on first run of this test.

To prevent computing this string constant at compile time you can use a 
variable. And '\x00' can be used instead of '\u', it needs less memory.

--
keywords: +patch
nosy: +serhiy.storchaka
status: closed - open
Added file: 
http://bugs.python.org/file37978/test_encode_basestring_ascii_overflow.patch

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



[issue22896] Don't use PyObject_As*Buffer() functions

2015-02-02 Thread Stefan Krah

Stefan Krah added the comment:

Thanks.  No, I don't think there's an official way to accomplish that,
but let's create one.  How about a new function that takes the buffer
request flags:

PyMemoryView_FromObjectEx(exporter, PyBUF_SIMPLE|PyBUF_WRITABLE)

If we can spare a new format code, this could be called directly in
PyArg_ParseTuple(), which would give back the memoryview.

Otherwise, you get the exporter from PyArg_ParseTuple() and call
PyMemoryView_FromObjectEx() manually.

If I'm not mistaken, this would save us the intermediate buffer on the
stack, and it's more readable.

--

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread STINNER Victor

STINNER Victor added the comment:

 A unit test would not be so helpful. The potential problem is that
 third party extensions with broken getbufferprocs would suffer.

I don't understand the link between third party extensions and
test_getargs2. test_getargs2 is a unit test for non-regression of
CPython. Can you please elaborate?

--

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



ANN: psutil 2.2.1 released

2015-02-02 Thread Giampaolo Rodola'
Hello all,
I'm glad to announce the release of psutil 2.2.1.
This is a bugfix only release, fixing #572 on Linux:
https://github.com/giampaolo/psutil/issues/572

Links
=

* Home page: https://github.com/giampaolo/psutil
* Downloads:
https://pypi.python.org/pypi?:action=displayname=psutil#downloads
* Documentation: http://pythonhosted.org/psutil/

Please try out this new release and let me know if you experience
any problem by filing issues on the bug tracker.

All the best,


-- 
Giampaolo - http://grodola.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


[issue23377] HTTPResponse may drop buffer holding next response

2015-02-02 Thread Martin Panter

New submission from Martin Panter:

This is the same issue raised at https://bugs.python.org/issue4879#msg91597. 
Currently, every time a new response is to be received, HTTPConnection passes 
its raw socket object to HTTPResponse, which calls sock.makefile(rb) and 
creates a BufferedReader. The BufferedReader is used to parse the header 
section and read the response body. The problem is that the BufferedReader is 
closed at the end of reading the response, potentially losing buffered data 
read from a subsequent response.

Normally no data is lost, because most users would read the full response 
before triggering a new request, and the server would wait for a request before 
sending a response. But if a user pipelined a second request without reading 
all of the first response, and the server happened to send the end of the first 
response and the start of the second response in the same packet, it could 
trigger the problem. I have added a test called 
test_httplib.ServerTest.testDoubleResponse() which emulates this scenario. The 
problem also makes it hard to detect misbehaving servers, or use HTTPConnection 
to test that a server is behaving correctly.

I am adding a patch which creates the BufferedReader once for each connection. 
This involves changing the API of the HTTPResponse constructor. I think this 
should be okay because even though it is documented, it says “Not instantiated 
directly by user”. It did require changing the tests that call the HTTPResponse 
constructor though. If absolutely necessary, it may be possible to maintain 
backwards compatibility if we added a new constructor parameter, and carefully 
juggled how the close() calls work.

--
components: Library (Lib)
files: http-buffer.patch
keywords: patch
messages: 235251
nosy: vadmium
priority: normal
severity: normal
status: open
title: HTTPResponse may drop buffer holding next response
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file37977/http-buffer.patch

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



[issue4879] Allow buffering for HTTPResponse

2015-02-02 Thread Martin Panter

Martin Panter added the comment:

Opened Issue 23377 for the problem of dropping extra buffered data at the end 
of a response.

--
nosy: +vadmium

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



Re: [OT] fortran lib which provide python like data type

2015-02-02 Thread Paul Rudin
Marko Rauhamaa ma...@pacujo.net writes:

 Chris Angelico ros...@gmail.com:

 On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 And there are underspecified rules too. What is the plural of octopus? No
 fair looking it up in the dictionary.

 Standard and well-known piece of trivia, and there are several
 options. Octopodes is one of the most rigorously formal, but
 octopuses is perfectly acceptable. Octopi is technically
 incorrect, as the -us ending does not derive from the Latin.

 Your brain's grammar engine will give you the correct answer. It may not
 match your English teacher's answer, but the language we are talking
 about is not standard English but the dialect you have acquired in
 childhood.

Aha - the Humpty Dumpty approach to English usage: When I use a word it
means just what I choose it to mean...

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


Re: [OT] fortran lib which provide python like data type

2015-02-02 Thread Marko Rauhamaa
Paul Rudin paul.nos...@rudin.co.uk:

 Marko Rauhamaa ma...@pacujo.net writes:
 Your brain's grammar engine will give you the correct answer. It may
 not match your English teacher's answer, but the language we are
 talking about is not standard English but the dialect you have
 acquired in childhood.

 Aha - the Humpty Dumpty approach to English usage: When I use a word
 it means just what I choose it to mean...

Yes, and your Humpty Dumpty brain is stringent about the proper usage.
Your brain happens to be highly aligned with those of your childhood
friends. Your communal dialect has thousands of rigorous rules, only you
couldn't make a complete list of them.


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


[issue20709] os.utime(path_to_directory): wrong documentation for Windows.

2015-02-02 Thread Jan-Philip Gehrcke

Jan-Philip Gehrcke added the comment:

Windows is the only Python-supported platform where utime did not work for 
directories, ages ago, right?

If that is the case, I support Larry Hastings' approach of removing the entire 
sentence:

Whether a directory can be given for path depends on whether the operating 
system implements directories as files (for example, *Windows does not*)

Agreed?

--

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



Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Steven D'Aprano
Devin Jeanpierre wrote:

 On Mon, Feb 2, 2015 at 4:06 AM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:

 instance.f is a method by the glossary definition. Its type is identical
 to types.MethodType, which is what I used to create a method by hand.
 
 You are assuming that they are both methods, just because they are
 instances of a type called MethodType. This is like assuming that a
 Tree() object is made out of wood.

No. It is assuming that a Tree() object is a Tree() object.

Run this code:

# === cut ===

class K(object):
def f(self): pass

def f(self): pass

instance = K()
things = [instance.f, f.__get__(instance, K)]
from random import shuffle
shuffle(things)
print(things)

# === cut ===


You allege that one of these things is a method, and the other is not. I
challenge you to find any behavioural or functional difference between the
two. (Object IDs don't count.)

If you can find any meaningful difference between the two, I will accept
that methods have to be created as functions inside a class body.

Otherwise you are reduced to claiming that there is some sort of mystical,
undetectable essence or spirit that makes one of those two objects a
real method and the other one a fake method, even though they have the same
type, the same behaviour, and there is no test that can tell you which is
which.


 The documentation is free to define things in terms other than types
 and be correct. 

If you wanted to argue that method is a generic term, and we have instance
methods, class methods, static methods, and any other sort of method we
care to create using the descriptor protocol, then I would agree you have a
point.

But since we're just talking about instance methods, Python doesn't care how
they came into existence. You can use def to create a function inside a
class body, inject a function into the class, call the descriptor __get__
method, or use the types.MethodType type object, it is all the same. You
can use a def statement, or a lambda, or types.FunctionType if you are
really keen. It makes no difference.

Do I expect the glossary to go into such pedantic detail? No, of course not.
But I do expect anyone with a few years of Python programming experience to
be able to understand that what makes a method be a method is its type and
behaviour, not where it came from.


 There are many properties of functions-on-classes that 
 callable instance attributes that are instances of MethodType do not
 have, as we've already noticed. isinstance can say one thing, and the
 documentation another, and both can be right, because they are saying
 different things.
 
 
 For an example we can all agree on, this is not an instance of
 collections.Iterable, but the docs claim it is iterable:
 https://docs.python.org/2/glossary.html#term-iterable
 
 class MyIterable(object):
 def __getitem__(self, i): return i

Iterable is a generic term, not a type. Despite the existence of the
collections.Iterable ABC, iterable refers to any type which can be
iterated over, using either of two different protocols.

As I said above, if you wanted to argue that method was a general term for
any callable attached to an instance or class, then you might have a point.
But you're doing something much weirder: you are arguing that given two
objects which are *identical* save for their object ID, one might be called
a method, and the other not, due solely to where it was created. Not even
where it was retrieved from, but where it was created.

If you believe that method or not depends on where the function was
defined, then this will really freak you out:


py class Q:
... def f(self): pass  # f defined inside the class
...
py def f(self): pass  # f defined outside the class
...
py f, Q.f = Q.f, f  # Swap the inside f and the outside f.
py instance = Q()
py instance.f  # Uses outside f, so not a real method!
bound method Q.f of __main__.Q object at 0xb7b8fcec
py MethodType(f, instance)  # Uses inside f, so is a real method!
bound method Q.f of __main__.Q object at 0xb7b8fcec



-- 
Steven

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


[issue23357] pyvenv help shows incorrect usage

2015-02-02 Thread Vinay Sajip

Vinay Sajip added the comment:

I will add to the documentation, and leave this issue open till I've done that.

--

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



Re: How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-02 Thread Amirouche Boubekki
On Mon Feb 02 2015 at 10:55:26 AM yacinechaou...@yahoo.com.dmarc.invalid
wrote:

 I wrote a little script that acts like a proxy, you just give it a URL and
 it will fetch the content and display it back to you.

 For some reason, this proxy blocks sometimes and refuses to serve any new
 queries. The script still runs, but it seems like it's stuck somewhere.

 When I strace it to see what it's doing, I find it hanging on this
 instruction :
 root@backup[10.10.10.21] ~/SCRIPTS/INFOMANIAK # strace -fp 6918
 Process 6918 attached - interrupt to quit
 recvfrom(6,
 ^CProcess 6918 detached
 root@backup[10.10.10.21] ~/SCRIPTS/INFOMANIAK #

 I read in the SimpleHTTPServer source code that one can inherit from the
 SocketServer.TrheadingMixIn mixin to enable a threaded server to handle
 multiple requests at a time instead of just one (thinking maybe that's what
 was blocking it). However, it seems like it has nothing to do with my
 problem. What I need to do is not only handle multiple requests at a time,
 but more importantly to make the request handler non-blocking.

 Any ideas ? here's come code :

 import SimpleHTTPServer
 import BaseHTTPServer
 import SocketServer
 import requests

 class Handler(SocketServer.ThreadingMixIn,SimpleHTTPServer.SimpleH
 TTPRequestHandler):
 def do_GET(self):
 self.send_response(200)
 self.send_header('Content-Type', 'text/html')
 self.end_headers()
 # self.path will contain a URL to be fetched by my proxy
 self.wfile.write(getFlux(self.path.lstrip(/)))

 session = requests.Session()
 IP,PORT = MY_IP_HERE,8080

 def getFlux(url):
 response  = session.get(url)
 s = response.text
 return s

 server = BaseHTTPServer.HTTPServer((IP,PORT),Handler)
 server.serve_forever()



Your code seem perfectly fine. I had some trouble with py3's http.server
with IE10 (in a virtualbox...), I put together a small server script
similar to http.server that doesn't hang up on microsoft. It works with
ayncio. It's not ready to serve big files, but hopefully you can fix that.


HTH



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

#!/usr/bin/env python3
import os
import mimetypes
from asyncio import coroutine
from asyncio import get_event_loop

from aiohttp.web import Application
from aiohttp.web import StaticRoute
from aiohttp.web import HTTPNotFound
from aiohttp.web import HTTPMovedPermanently
from aiohttp.web import StreamResponse


class StaticRouteWithIndex(StaticRoute):

limit = 8192

@coroutine
def handle(self, request):
resp = StreamResponse()
filename = request.match_info['filename']
filepath = os.path.join(self._directory, filename)

if '..' in filename:
print('not found %s' % filepath)
raise HTTPNotFound()
if not os.path.exists(filepath):
print('not found %s' % filepath)
raise HTTPNotFound()

if not os.path.isfile(filepath):
directory = filepath
filename = None
if not filepath.endswith('/'):
path = filepath + '/'
path = path[len(self._directory):]
raise HTTPMovedPermanently(path)
for index in ('index.html', 'index.htm'):
path = os.path.join(directory, index)
if os.path.exists(path):
filename = index
filepath = path
break

if not filename and os.path.isdir(filepath):
if not filepath.endswith('/'):
filepath += '/'
names = os.listdir(filepath)
names.sort()
output = 'ul'
for name in names:
dirname = os.path.join(filepath, name)
if os.path.isdir(dirname):
dirname += '/'
path = dirname[len(self._directory):]
link = 'a href=%s%s/a' % (path, name)
output += 'li' + link + '/li'
output += '/ul'
resp.content_type = 'text/html'
resp.start(request)
resp.write(output.encode('utf-8'))
return resp
elif not filename:
print('not found %s' % filepath)
raise HTTPNotFound()
else:
ct = mimetypes.guess_type(filename)[0]
if not ct:
ct = 'application/octet-stream'
resp.content_type = ct

file_size = os.stat(filepath).st_size
single_chunk = file_size  self.limit

if single_chunk:
resp.content_length = file_size
resp.start(request)

with open(filepath, 'rb') as f:
chunk = f.read(self.limit)
if single_chunk:
resp.write(chunk)
else:
while chunk:
resp.write(chunk)
chunk = f.read(self.limit)
print('ok %s' 

[issue23357] pyvenv help shows incorrect usage

2015-02-02 Thread Raúl Cumplido

Raúl Cumplido added the comment:

thanks for the comments.
@haypo I'll add a new one for the pep8 fixes, sorry.
@vinay.sajip I would like to help and try to do the change myself, if this is 
ok with you

--

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



[issue23321] Crash in str.decode() with special error handler

2015-02-02 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
resolution:  - fixed
status: pending - closed

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



[issue23321] Crash in str.decode() with special error handler

2015-02-02 Thread STINNER Victor

STINNER Victor added the comment:

I closed the issue.

--

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



[issue21295] Python 3.4 gives wrong col_offset for Call nodes returned from ast.parse

2015-02-02 Thread Mark Shannon

Mark Shannon added the comment:

This is caused by https://hg.python.org/cpython/rev/7c5c678e4164/
which is a supposed fix for http://bugs.python.org/issue16795
which claims to make some changes to AST to make it more useful for static 
language analysis, seemingly by breaking all existing static analysis tools.

Could we just revert https://hg.python.org/cpython/rev/7c5c678e4164/ ?

--
nosy: +Mark.Shannon

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



Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Rustom Mody
On Monday, February 2, 2015 at 10:57:27 AM UTC+5:30, Vito De Tullio wrote:
 Steven D'Aprano wrote:
 
  Checking the REPL first would have revealed that [].__dir__ raises
  AttributeError. In other words, lists don't have a __dir__ method.
 
 ?
 
 Python 3.4.2 (default, Nov 29 2014, 00:45:45) 
 [GCC 4.8.3] on linux
 Type help, copyright, credits or license for more information.
  [].__dir__()
 ['sort', '__contains__', '__init__', '__ge__', 'count', '__class__', 
 '__format__', '__mul__', 'index', '__rmul__', '__hash__', '__iter__', 
 'clear', '__subclasshook__', '__getitem__', 'reverse', 'append', '__ne__', 
 'pop', '__reduce__', '__add__', 'extend', '__gt__', '__sizeof__', 
 '__setattr__', '__imul__', '__dir__', '__le__', 'insert', '__repr__', 
 '__str__', '__getattribute__', '__len__', '__lt__', 'remove', '__new__', 
 '__reduce_ex__', 'copy', '__reversed__', '__delattr__', '__eq__', 
 '__setitem__', '__iadd__', '__doc__', '__delitem__']
  

Sure
But as I said (and probably Steven checked):

$ python
Python 2.7.8 (default, Oct 20 2014, 15:05:19) 
[GCC 4.9.1] on linux2
Type help, copyright, credits or license for more information.
 [].__dir__
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'list' object has no attribute '__dir__'

---
My point was more methodological/sociological than technical:

Are these dunder methods as 'internal' as say the register-allocation used
by a C compiler?

In which case the language implementer is entitled to tell the vanilla 
programmer: Dunder methods (and their changingness) is none of your business

If however they are more on the public façade of the language then some better
docs would be nice
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23255] SimpleHTTPRequestHandler refactor for more extensible usage.

2015-02-02 Thread Martin Panter

Martin Panter added the comment:

You’re welcome to merge my test patch into yours if you want to. Or I could 
open a separate issue for it, I don’t mind.

--

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-02 Thread Stefan Krah

Changes by Stefan Krah ste...@bytereef.org:


--
nosy: skrah
priority: normal
severity: normal
status: open
title: getargs.c: redundant C-contiguity check
type: performance
versions: Python 3.5

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



Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Steven D'Aprano
Steven D'Aprano wrote:

 Both K.f and K.g are methods, even though only one meets the definition
 given in the glossary. The glossary is wrong.

Oh I'm sure somebody is going to pick me up on this... 

In Python 2, they are methods. In Python 3, they are functions, and aren't
converted into methods until you access them via the instance:

K.f returns the function f

instance.f typically retrieves the function f from K, and converts it to a
method object bound to instance



-- 
Steven

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


How to write a non blocking SimpleHTTPRequestHandler ?

2015-02-02 Thread yacinechaouche
I wrote a little script that acts like a proxy, you just give it a URL and it 
will fetch the content and display it back to you. 

For some reason, this proxy blocks sometimes and refuses to serve any new 
queries. The script still runs, but it seems like it's stuck somewhere.

When I strace it to see what it's doing, I find it hanging on this instruction 
: 
root@backup[10.10.10.21] ~/SCRIPTS/INFOMANIAK # strace -fp 6918
Process 6918 attached - interrupt to quit
recvfrom(6,
^CProcess 6918 detached
root@backup[10.10.10.21] ~/SCRIPTS/INFOMANIAK # 

I read in the SimpleHTTPServer source code that one can inherit from the 
SocketServer.TrheadingMixIn mixin to enable a threaded server to handle 
multiple requests at a time instead of just one (thinking maybe that's what was 
blocking it). However, it seems like it has nothing to do with my problem. What 
I need to do is not only handle multiple requests at a time, but more 
importantly to make the request handler non-blocking.

Any ideas ? here's come code : 

import SimpleHTTPServer
import BaseHTTPServer
import SocketServer
import requests

class 
Handler(SocketServer.ThreadingMixIn,SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-Type', 'text/html')
self.end_headers()
# self.path will contain a URL to be fetched by my proxy
self.wfile.write(getFlux(self.path.lstrip(/)))

session = requests.Session()
IP,PORT = MY_IP_HERE,8080

def getFlux(url):
response  = session.get(url)
s = response.text
return s

server = BaseHTTPServer.HTTPServer((IP,PORT),Handler)
server.serve_forever()

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


Re: dunder-docs (was Python is DOOMED! Again!)

2015-02-02 Thread Steven D'Aprano
Devin Jeanpierre wrote:

 -- Devin
 
 On Sun, Feb 1, 2015 at 11:15 PM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 Gregory Ewing wrote:

 Steven D'Aprano wrote:
 [quote]
 If the object has a method named __dir__(), this method will
 be called and must return the list of attributes.
 [end quote]

 The first inaccuracy is that like all (nearly all?) dunder methods,
 Python only looks for __dir__ on the class, not the instance itself.

 It says method, not attribute, so technically
 it's correct. The methods of an object are defined
 by what's in its class.

 Citation please. I'd like to see where that is defined.
 
 https://docs.python.org/3/glossary.html#term-method

Run this code using any version of Python from 1.5 onwards, and you will see
that the definition is wrong:


# === cut ===

class K:
def f(self): pass

# Define a function OUTSIDE of a class body.
def g(self): pass

K.g = g
instance = K()
assert type(instance.f) is type(instance.g)
print(type(instance.f))
print(type(instance.g))

# === cut ===


Both K.f and K.g are methods, even though only one meets the definition
given in the glossary. The glossary is wrong.

Or rather, it is not so much that it is *wrong*, but that it is incomplete
and over-simplified. It describes how methods are normally (but not always)
defined, but not what they are. It is rather like defining coffee as the
milky drink you buy from Starbucks, then insisting that the black liquid
that you drank in an Italian restaurant cannot be coffee because you didn't
buy it from Starbucks.

Glossary entries are typically simplified, not exhaustive. It is not wise to
take a three line glossary entry as a complete, definite explanation. In
this case the glossary fails to tell you that methods are not *required* to
be defined inside a class body, that is merely the usual way to do it.



 Even if it is so defined, the definition is wrong. You can define methods
 on an instance. I showed an example of an instance with its own personal
 __dir__ method, and showed that dir() ignores it if the instance belongs
 to a new-style class but uses it if it is an old-style class.
 
 You didn't define a method, you defined a callable attribute.

That is wrong. I defined a method:

py from types import MethodType
py type(instance.f) is MethodType
True


instance.f is a method by the glossary definition. Its type is identical to
types.MethodType, which is what I used to create a method by hand.

I could also call the descriptor __get__ method by hand, if you prefer:

py def h(self): pass
...
py method = h.__get__(K, instance)
py assert type(method) is type(instance.f)
py print(method)
bound method type.h of class '__main__.K'



-- 
Steven

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


[issue23359] Speed-up set_lookkey()

2015-02-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Before doing more study on the other variants, I would like to get the second 
transformation done (avoiding the mask computation in the case where there is 
no wrap-around).  Attaching a patch for just that step.

--
Added file: http://bugs.python.org/file37975/hoist_mask_only.diff

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



[issue20709] os.utime(path_to_directory): wrong documentation for Windows.

2015-02-02 Thread Larry Hastings

Larry Hastings added the comment:

I'm not sure we support 2.7 supports any versions of Windows earlier than XP.  
If so, we could drop the provision entirely.

--

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



[issue16632] Enable DEP and ASLR

2015-02-02 Thread STINNER Victor

STINNER Victor added the comment:

I reopen the issue, so the question of porting the change to Python 2.7 can be 
replied.

--
nosy: +steve.dower
resolution: fixed - 
status: closed - open

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



[issue21295] Python 3.4 gives wrong col_offset for Call nodes returned from ast.parse

2015-02-02 Thread Mark Shannon

Mark Shannon added the comment:

It is now very hard to determine accurate locations for an expression such as 
(x+y).attr as the column offset of leftmost subexpression of the expression is 
not the same as the column offset of the location.

--

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



Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Rustom Mody
On Tuesday, February 3, 2015 at 4:51:18 AM UTC+5:30, Gabriel Ferreira wrote:
 Mark Lawrence  wrote:
 
  I don't actually know, but could you please provide some context and 
  write in plain English, those damn ... things are extremely annoying.
  
 
 Hi, Mark. 
 
 I am developing a research project, which includes video analysis (computer 
 vision, big data, data mining, etc). The first part of the project is about 
 building a database containing a big amount of video of urban zones. I live 
 in Brazil, so the plan is collecting videos from urban areas of Brazilian big 
 cities, like Sao Paulo. 
 
 I have to make this task automatic. in other words, I don't want to 
 manually download hundreds or thousands hours of videos. So I have to develop 
 a robot to do that assingment for me. (I wish I could do that using Python).

Develop robot -- right
Do it in python -- probably not so right

 
 I have found a good website that provides me live images from several cities 
 in Brazil. So that's it! That's what I need. I was expecting to develop a 
 program to record  download those videos, that are being broadcasted live on 
 that website. So I would be able to form my database and continue my research.
 
 The problem is that this particular website uses a flash player application 
 do broadcast the live images of the urban areas. I'm not too familiar with 
 Flash Applications. I don't know how to deal with them using Python. I was 
 wondering if someone could help me solve this problem. The goal is recording 
  downloading those videos, from the mentioned website. And, yes, it has to 
 be an automated program (no manual work).

The instinct is natural but probably inaccurate:
Python is nice; JS/Flash not so much.

However to get on top of this you probably need to debug the streaming
with a modern browser using JS developer-tools/firebug etc, so that then
you can script what you have debugged.

If you do it in JS, there will be minor glitches once you have debugged the 
process.
If you do it in python, you will have to jump into (rather out of) many hoops
to go from JS to python.
And debugging the process is not an option.

[Disclaimer: I dont know what I am talking about]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Downloading videos (in flash applications) using python

2015-02-02 Thread Michael Torrie
On 02/02/2015 04:21 PM, Gabriel Ferreira wrote:
 The problem is that this particular website uses a flash player
 application do broadcast the live images of the urban areas. I'm not
 too familiar with Flash Applications. I don't know how to deal with
 them using Python. I was wondering if someone could help me solve
 this problem. The goal is recording  downloading those videos, from
 the mentioned website. And, yes, it has to be an automated program
 (no manual work).

As I said before you need to look into the RTP protocol.  There are
utilities for proxying and dumping the stream parameters.  Once they are
known you can pull them in using rtmpdump.  Sometimes the stream
parameters can be determined from the web page.  get_iplayer, for
instance, can create rtp parameters for BBC programs and then stream
them with rtmpdump, since the parameters seem to be well defined and
consistent.  But every streaming site is going to be different.  I
posted the link to the rtmpdump utilities in my other post.  You may be
to drive rtmpdump from Python.

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


Re: Ghost vulnerability

2015-02-02 Thread Chris Angelico
On Tue, Feb 3, 2015 at 2:53 PM, Rustom Mody rustompm...@gmail.com wrote:
 How many people (actually machines) out here are vulnerable?

 http://security.stackexchange.com/questions/80210/ghost-bug-is-there-a-simple-way-to-test-if-my-system-is-secure

 shows a python 1-liner to check

Well, I have one internal disk server that's vulnerable. It's not
accessible to the world, which is why it's still running Ubuntu 10.10,
and it's affected. I'm not too concerned about Huix coming under
attack.

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


[issue2786] Names in traceback should have class names, if they're methods

2015-02-02 Thread Robert Collins

Robert Collins added the comment:

I wonder if you could add this to the new code in 
http://bugs.python.org/issue17911 which I'm hoping to commit this week.

--
nosy: +rbcollins

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



[issue23336] Thread.LockType is misnamed

2015-02-02 Thread Josh Rosenberg

Josh Rosenberg added the comment:

The thread and dummy_thread modules have a leading underscore in Py3.4, but the 
same naming issue is present there as well.

--
nosy: +josh.r

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



Ghost vulnerability

2015-02-02 Thread Rustom Mody
How many people (actually machines) out here are vulnerable?

http://security.stackexchange.com/questions/80210/ghost-bug-is-there-a-simple-way-to-test-if-my-system-is-secure

shows a python 1-liner to check
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20709] os.utime(path_to_directory): wrong documentation for Windows.

2015-02-02 Thread Jan-Philip Gehrcke

Changes by Jan-Philip Gehrcke jgehr...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file37979/issue20709_py27.patch

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



[issue23374] pydoc 3.x raises UnicodeEncodeError on sqlite3 package

2015-02-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are few levels of this issue:

1) pydoc doesn't escape characters according to output encoding. It escapes 
characters uneencodable with sys.getfilesystemencoding(), but this encoding can 
differ from the encoding of sys.stdout or default encoding.

2) Default encoding for io.TestIOWrapper() and open() can be different from 
sys.getfilesystemencoding(). And it unexpectedly can be ASCII.

3) Mac OS doesn't support locales with the utf8 encoding (without hyphen).

Here is a patch which solves first level -- makes pydoc using appropriate 
encoding with the backslashreplace error handler.

--
keywords: +patch
stage:  - patch review
type: crash - behavior
versions:  -Python 3.2, Python 3.3
Added file: http://bugs.python.org/file37981/pydoc_encoding.patch

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



[issue16795] Patch: some changes to AST to make it more useful for static language analysis

2015-02-02 Thread Benjamin Peterson

Benjamin Peterson added the comment:

People pointed out in #21295 that this made some things that were possible 
before impossible, so the lineno and col_offset changes of this have been 
reverted.

--

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



[issue21295] Python 3.4 gives wrong col_offset for Call nodes returned from ast.parse

2015-02-02 Thread Mark Shannon

Mark Shannon added the comment:

This also breaks the col_offset for subscripts like x[y] and, of course any 
statement with one of these expressions as its leftmost sub-expression.

--

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



[issue21295] Python 3.4 gives wrong col_offset for Call nodes returned from ast.parse

2015-02-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7d1c32ddc432 by Benjamin Peterson in branch '3.4':
revert lineno and col_offset changes from #16795 (closes #21295)
https://hg.python.org/cpython/rev/7d1c32ddc432

New changeset 8ab6b404248c by Benjamin Peterson in branch 'default':
merge 3.4 (#21295)
https://hg.python.org/cpython/rev/8ab6b404248c

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



  1   2   >