[Python-Dev] posix_confstr seems wrong
More C++ stuff... According to the man page on my Mac: If the call to confstr() is not successful, -1 is returned and errno is set appropriately. but the code in posix_confstr looks like: if (PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name)) { int len = confstr(name, buffer, sizeof(buffer)); errno = 0; if (len == 0) { if (errno != 0) posix_error(); else result = PyString_FromString(""); } ... 1. Why is errno being set to 0? 2. Why is errno's value then tested to see if it's not zero? Looks like this have been that way since December 1999 when Fred added it. Skip ___ 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] posix_confstr seems wrong
On Monday 17 April 2006 17:39, [EMAIL PROTECTED] wrote: > 1. Why is errno being set to 0? The C APIs don't promise to clear errno on input; you have to do that yourself. > 2. Why is errno's value then tested to see if it's not zero? > > Looks like this have been that way since December 1999 when Fred added it. Looks like a bug to me. It should be set just before confstr() is called. -Fred -- Fred L. Drake, Jr. ___ 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] posix_confstr seems wrong
Fred> Looks like a bug to me. It should be set just before confstr() is Fred> called. Thanks. I'll fix, test and check in... Skip ___ 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