Re: [Python-Dev] devguide: Backporting is obsolete. Add details that I had to learn.

2012-01-09 Thread Terry Reedy

On 1/9/2012 8:52 PM, Nick Coghlan wrote:

On Tue, Jan 10, 2012 at 7:59 AM, Antoine Pitrou  wrote:

Please avoid using the terms "minor version" and "major version", they
are confusing.


Indeed. "Feature release" (2.7, 3.2, 3.3) and "release series" (2.x,
3.x) are the least confusing terms we have available.


I minimally edited what was already there to correct what is now an 
error. The change comes immediately after a section defining major, 
minor, and micro releases. To change terms,

http://docs.python.org/devguide/devcycle.html
and possibly other pages needs more extensive editing.

--
Terry Jan Reedy

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] devguide: Backporting is obsolete. Add details that I had to learn.

2012-01-09 Thread Nick Coghlan
On Tue, Jan 10, 2012 at 7:59 AM, Antoine Pitrou  wrote:
> Please avoid using the terms "minor version" and "major version", they
> are confusing.

Indeed. "Feature release" (2.7, 3.2, 3.3) and "release series" (2.x,
3.x) are the least confusing terms we have available.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] svn.python.org certificate expired

2012-01-09 Thread Charles-François Natali
Hi,

All the buildbots are turning red because of test_ssl:
"""
==
ERROR: test_connect (test.test_ssl.NetworkedTests)
--
Traceback (most recent call last):
  File "/var/lib/buildslave/3.x.murray-gentoo-wide/build/Lib/test/test_ssl.py",
line 616, in test_connect
s.connect(("svn.python.org", 443))
  File "/var/lib/buildslave/3.x.murray-gentoo-wide/build/Lib/ssl.py",
line 519, in connect
self._real_connect(addr, False)
  File "/var/lib/buildslave/3.x.murray-gentoo-wide/build/Lib/ssl.py",
line 509, in _real_connect
self.do_handshake()
  File "/var/lib/buildslave/3.x.murray-gentoo-wide/build/Lib/ssl.py",
line 489, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [Errno 1] _ssl.c:420: error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
"""

It seems that svn.python.org certificate expired today (09/01/2012).

Cheers,

cf
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] devguide: Backporting is obsolete. Add details that I had to learn.

2012-01-09 Thread Antoine Pitrou
On Mon, 09 Jan 2012 21:58:29 +0100
terry.reedy  wrote:
>  
> -Different branches are used at a time to represent different *minor versions*
> -in which development is made.  All development should be done **first** in 
> the
> -:ref:`in-development ` branch, and selectively backported
> -to other branches when necessary.
> +There is a branch for each *minor version*. Development is done separately
> +for Python 2 and Python 3. For each *major version*, each change should be 
> made
> +**first** in the oldest branch to which it applies and forward-ported as
> +appropriate.

Please avoid using the terms "minor version" and "major version", they
are confusing.

Thanks

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Python as a Metro-style App

2012-01-09 Thread Dino Viehland
We spent some time investigating Python/Win8 projections but we don't really 
have anything else to say right now, but it is certainly possible.

I haven't been following this thread so maybe this was already discussed, but 
on the whole "new OS target" thing - if people want to write immersive apps in 
Python then there will need to be a new build of Python.  One thing that might 
make that easier is the fact that the C runtime is still available to metro 
apps, even if the C runtime calls a banned API.  So to the extent that Python 
is just a C program the "port" should be pretty easy and mostly involve 
disabling functionality that isn't available at all to metro apps.  

I have packaged up Python 2.7 in an appx and run the application verifier on it 
(this was a while ago, so things may have changed between now and then), the 
attached banned.txt includes the list of APIs which Python is using that aren't 
allowed for the curious.

Also, people who write apps will need to distribute Python w/ their app, 
there's currently no sharing between apps.

-Original Message-
From: Jeff Hardy [mailto:jdha...@gmail.com] 
Sent: Sunday, January 08, 2012 10:13 PM
To: Antoine Pitrou
Cc: python-dev@python.org; Dino Viehland
Subject: Re: [Python-Dev] Python as a Metro-style App

On Sat, Jan 7, 2012 at 2:57 PM, Antoine Pitrou  wrote:
> Depending on the extent of removed/disabled functionality, it might 
> not be very interesting to have a Metro port at all.

Win 8 is practically a new OS target - the nt module may need to be replaced 
with a metro module to handle it well.

Accessing the WinRT APIs directly from Python will also require a set of Python 
projections for the API, which should be straightforward to generate from the 
WinRT metadata files. I know Dino Viehland did some work on that; not sure if 
he can elaborate or not though.

Otherwise, IronPython would be the only option for writing Metro apps in Python 
- not that I'd be *horribly* upset at that :). IronPython is slowly growing 
Metro support, and it seems like most things will work, but the .NET framework 
shields it from a lot of the WinRT guts.

- Jeff

API RegCloseKey in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegConnectRegistryA in advapi32.dll is not supported for this application 
type. python27.dll calls this API. 
API RegCreateKeyA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegCreateKeyExA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegDeleteKeyA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegDeleteValueA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegEnumKeyExA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegEnumValueA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegFlushKey in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegLoadKeyA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegOpenKeyExA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegQueryInfoKeyA in advapi32.dll is not supported for this application 
type. python27.dll calls this API. 
API RegQueryValueA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegQueryValueExA in advapi32.dll is not supported for this application 
type. python27.dll calls this API. 
API RegSaveKeyA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegSetValueA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API RegSetValueExA in advapi32.dll is not supported for this application type. 
python27.dll calls this API. 
API CreateDirectoryA in kernel32.dll is not supported for this application 
type. python27.dll calls this API. 
API CreateEventA in kernel32.dll is not supported for this application type. 
python27.dll calls this API. 
API CreateFileA in kernel32.dll is not supported for this application type. 
python27.dll calls this API. 
API CreateFileMappingA in kernel32.dll is not supported for this application 
type. python27.dll calls this API. 
API CreateFileW in kernel32.dll is not supported for this application type. 
python27.dll calls this API. 
API CreatePipe in kernel32.dll is not supported for this application type. 
python27.dll calls this API. 
API CreateProcessA in kernel32.dll is not supported for this application type. 
python27.dll calls this API. 
API DeleteFileA in kernel32.dll is not supported for this application type. 
python27.dll calls this API. 
API ExpandEnvironmentStringsW in kernel32.dll is not supported for this 
application type. python27.dll calls t

Re: [Python-Dev] Python C API: Problem sending tuple to a method of a python Class

2012-01-09 Thread Amaury Forgeot d'Arc
Good evening,

2012/1/9 

> **
> I am trying to send a tuple to a method of a python class and I got a Run
> failed from netbeans compiler
> when I want to send a tuple to a simple method in a module it works,when I
> want to send a simple parameter to a method of a clas it works also but not
> a tuple to a method of a class
>

This mailing list is for the development *of* python.
For development *with* python, please ask your questions on
the comp.lang.python group or the python-l...@python.org mailing list.
There you will find friendly people willing to help.

[for your particular question: keep in mind that PyObject_Call takes
arguments as a tuple;
if you want to pass one tuple, you need to build a 1-tuple around your
tuple]

-- 
Amaury Forgeot d'Arc
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] descriptor as instance attribute

2012-01-09 Thread Oleg Broytman
Hello.

   We are sorry but we cannot help you. This mailing list is to work on
developing Python (adding new features to Python itself and fixing bugs);
if you're having problems learning, understanding or using Python, please
find another forum. Probably python-list/comp.lang.python mailing list/news
group is the best place; there are Python developers who participate in it;
you may get a faster, and probably more complete, answer there. See
http://www.python.org/community/ for other lists/news groups/fora. Thank
you for understanding.

On Tue, Jan 10, 2012 at 01:32:13AM +1100, Jon Wells wrote:
> I can't find an answer to this grovelling through get user info. on
> descriptors.

   Read carefully http://users.rcn.com/python/download/Descriptor.htm

> Assuming desc() is a data descriptor class why are the following not the
> same???
> 
> class poop(object):
> var = desc()
> 
> and
> 
> class poop(object):
> def __init__(self):
> self.var = desc()
> 
> In the second form the descriptor protocol for access to 'var' is
> ignored. 

   From http://users.rcn.com/python/download/Descriptor.htm:

...transforms b.x into type(b).__dict__['x'].__get__(b, type(b))..

   Please note the first type(b).

Oleg.
-- 
 Oleg Broytmanhttp://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] descriptor as instance attribute

2012-01-09 Thread Jon Wells
I can't find an answer to this grovelling through get user info. on
descriptors.

Assuming desc() is a data descriptor class why are the following not the
same???

class poop(object):
var = desc()

and

class poop(object):
def __init__(self):
self.var = desc()

In the second form the descriptor protocol for access to 'var' is
ignored. 

Would seem to not make sense to me.

jon.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Python C API: Problem sending tuple to a method of a python Class

2012-01-09 Thread pasparis


Hello,I am trying to send a tuple to a method of a python class and I got a Run failed from netbeans compilerwhen I want to send a tuple to a simple method in a module it works,when I want to send a simple parameter to a method of a clas it works also but not a tuple to a method of a classI put the code below,thanks for all the possible suggestionsPython Code:class cVector:  def __init__(self,msg):    self.value = msg  def ComputeNorm(self,vecData):    #don't use vecData for instance    result = 12.    return(result)C++ Code :  PyObject *ret, *mymod, *pclass, *method, *args, *object;  float retValue;  Py_Initialize();  //PySys_SetPath("/home/pascal/projPytCpp/proj1");  PySys_SetPath(".");    // Module  mymod = PyImport_ImportModule("mModule8");  if (mymod == NULL){    cout << "Can't Open a module:\n" ;    Py_DECREF(mymod);  }    // Class  pclass = PyObject_GetAttrString(mymod, "cVector");  if (pclass == NULL) {    Py_DECREF(pclass);    cout << "Can't find class\n";  }    // Parameters/Values  args = Py_BuildValue("(f)", 100.0);  if (args == NULL) {    Py_DECREF(args);    cout << "Can't build argument list for class instance\n";  }    // Object with parameter/value  object = PyEval_CallObject(pclass, args);  if (object == NULL) {    Py_DECREF(object);    cout << "Can't create object instance:\n";  }    // Decrement the argument counter as we'll be using this again   Py_DECREF(args);    // Get the object method - note we use the object as the object  // from which we access the attribute by name, not the class   method = PyObject_GetAttrString(object, "ComputeNorm");  if (method == NULL) {    Py_DECREF(method);    cout << "Can't find method\n";  }    // Decrement the counter for our object, since we now just need  // the method reference   Py_DECREF(object);  // Build our argument list - an empty tuple because there aren't  // any arguments     cout << "Prepare the Tuple:\n" ;  // WE pass a tuple  args = PyTuple_New( 3 );  if (args == NULL) {    Py_DECREF(args);    cout << "Can't build argument list for method call\n";  }    PyObject  *py_argument;  // 1st argument   py_argument = PyFloat_FromDouble(5.);  PyTuple_SetItem(args, 0, py_argument);   // 2nd argument   py_argument = PyFloat_FromDouble(10.);  PyTuple_SetItem(args, 1, py_argument);    // 3nd argument   py_argument = PyFloat_FromDouble(15.);  PyTuple_SetItem(args, 2, py_argument);    cout << "Before the Exec:\n" ;  // Call our object method with arguments (try two ways to do it any works)  //ret = PyEval_CallObject(method,args);  ret = PyObject_CallObject(method,args);  if (ret == NULL) {    Py_DECREF(ret);    cout << "Couldn't call method\n";  }    // Convert the return value back into a C variable and display it   PyArg_Parse(ret, "f", &retValue);  printf("Farenheit: %f\n", retValue);  // Kill the remaining objects we don't need   Py_DECREF(method);  Py_DECREF(ret);  // Close off the interpreter and terminate   Py_Finalize();  


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as

2012-01-09 Thread Benjamin Peterson
2012/1/9 Charles-François Natali :
>>> Can rewinddir() end up touching the filesystem to retrieve data? I
>>> noticed that your previous change (the one this checkin reverted)
>>> moved it outside the GIL release macros.
>>
>> It just resets a position count. (in glibc).
>
> Actually, it also calls lseek() on the directory FD:
> http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/rewinddir.c;hb=HEAD
>
> But lseek() doesn't (normally) perform I/O, it just sets an offset in
> the kernel file structure:
> http://lxr.free-electrons.com/source/fs/read_write.c#L38

Sorry, I should have implied I looked at the kernel source, too. :)



-- 
Regards,
Benjamin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Compiling 2.7.2 on OS/2

2012-01-09 Thread Steven D'Aprano

Victor Stinner wrote:

-if os.name in ('nt', 'os2'):
+if os.name in ('nt'):


This change is wrong: it should be os.name == 'nt'.


Or possibly os.name in ('nt', ) (note the comma).


--
Steven

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Compiling 2.7.2 on OS/2

2012-01-09 Thread Victor Stinner
> -        if os.name in ('nt', 'os2'):
> +        if os.name in ('nt'):

This change is wrong: it should be os.name == 'nt'.

Victor
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Hash collision security issue (now public)

2012-01-09 Thread Victor Stinner
> That said, I don't think smallest-format is actually enforced with
> anything stronger than comments (such as in unicodeobject.h struct
> PyASCIIObject) and asserts (mostly calling
> _PyUnicode_CheckConsistency).  I don't have any insight on how
> prevalent non-conforming strings will be in practice, or whether
> supporting their equality will be required as a bugfix.

If you are only Python, you cannot create a string in a non canonical form.

If you use the C API, you can create a string in a non canonical form
using PyUnicode_New() + PyUnicode_WRITE, or
PyUnicode_FromUnicode(NULL, length) (or
PyUnicode_FromStringAndSize(NULL, length)) + direct access to the
Py_UNICODE* string. If you create strings in a non canonical form, it
is a bug in your application and Python doesn't help you. But how
could Python help you? Expose a function to check your newly creating
string? There is already _PyUnicode_CheckConsistency() which is slow
(O(n)) because it checks each character, it is only used in debug
mode.

Victor
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] py3benchmark not working

2012-01-09 Thread Mark Shannon

Christian Heimes wrote:

Hello,

I tried to compare the py3k baseline with my randomhash branch but the
benchmark suite is failing.

I've follewed the instruction

#   hg clone http://hg.python.org/benchmarks/ py2benchmarks
#   mkdir py3benchmarks;
#   cd py3benchmarks
#   ../py2benchmarks/make_perf3.sh ../py2benchmarks
#   python3.1 perf.py -b py3k old_py3k new_py3k

but the suite immediately bails out:


[snip]

"/media/ssd/heimes/python/py3benchmarks/lib/2to3/lib2to3/fixes/fix_operator.py",
line 89, in _check_method
method = getattr(self, "_" + results["method"][0].value.encode("ascii"))
TypeError: Can't convert 'bytes' object to str implicitly



You can temporarily "fix" this by removing the .encode("ascii")
from line 89 in lib2to3/fixes/fix_operator.py

I'm not sure if this is a bug in 2to3 or the benchmark.

Cheers,
Mark
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] [Python-checkins] cpython: Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as

2012-01-09 Thread Charles-François Natali
>> Can rewinddir() end up touching the filesystem to retrieve data? I
>> noticed that your previous change (the one this checkin reverted)
>> moved it outside the GIL release macros.
>
> It just resets a position count. (in glibc).

Actually, it also calls lseek() on the directory FD:
http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/rewinddir.c;hb=HEAD

But lseek() doesn't (normally) perform I/O, it just sets an offset in
the kernel file structure:
http://lxr.free-electrons.com/source/fs/read_write.c#L38

For example, it's not documented to return EINTR.

Now, one could imagine that the kernel could do some read-ahead or
some other magic things when passed SEEK_DATA or SEEK_HOLE, but
seeking at the beginning of a directory FD should be fast.

Anyway, I ended up reverting this change, because for some reason this
broke OpenIndiana buildbots (maybe rewinddir() is a no-op before
readdir() has been called?).

Cheers,

cf
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Hash collision security issue (now public)

2012-01-09 Thread Stefan Behnel
Jim Jewett, 08.01.2012 23:33:
> Stefan Behnel wrote:
>> Admittedly, this may require some adaptation for the PEP393 unicode memory
>> layout in order to produce identical hashes for all three representations
>> if they represent the same content.
> 
> They SHOULD NOT represent the same content; comparing two strings
> currently requires converting them to canonical form, which means the
> smallest format (of those three) that works.
> [...]
> That said, I don't think smallest-format is actually enforced with
> anything stronger than comments (such as in unicodeobject.h struct
> PyASCIIObject) and asserts (mostly calling
> _PyUnicode_CheckConsistency).

That's what I meant. AFAIR, the PEP393 discussions at some point brought up
the suspicion that third party code may end up generating Unicode strings
that do not comply with that "invariant". So internal code shouldn't
strictly rely on it when it deals with user provided data. One example is
the "unequal kinds" optimisation in equality comparison, which, if I'm not
mistaken, wasn't implemented, due to exactly this reasoning. The same
applies to hashing then.

Stefan

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com