This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author koobs
Recipients christian.heimes, kj, koobs, miss-islington
Date 2022-04-05.23:05:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1649199954.76.0.381754704932.issue47205@roundup.psfhosted.org>
In-reply-to
Content
From one of our base/kernel developers:

--------------------------------------------------------------

> koobs wrote:
>
> I don't grok the system call semantics, but it appears the issue is calls
> with the '-1' argument:
>
> mask = posix.sched_getaffinity(0)
> ...
> self.assertRaises(OSError, posix.sched_getaffinity, -1)
> ...
> self.assertRaises(OSError, posix.sched_setaffinity, -1, mask)
>
> This line was added 10 years ago in:
>
> https://github.com/python/cpython/commit/848698727fcbb633246b56ab57080b4d5493c186
>
> It wants an OSError [1] and presumably was getting it before recent
> failures, but isn't anymore:
>
> [1] https://docs.python.org/3/library/exceptions.html#OSError

So this is the difference:

Python 3.11.0a6+ (heads/main:38ae5b8c0c, Apr  5 2022, 03:27:23) [GCC 11.2.0] on freebsd13
Type "help", "copyright", "credits" or "license" for more information.
>>> import posix
>>> mask = posix.sched_getaffinity(-1)
>>> mask
{0, 1, 2, 3, 4, 5, 6, 7}

Python 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import posix
>>> mask = posix.sched_getaffinity(-1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ProcessLookupError: [Errno 3] No such process

FreeBSD always accepted -1 as denoting the current process, while Linux
does not.  In fact, Linux uses 0 as current process pid alias.

For FreeBSD, both -1 and 0 works as getpid(), and I do not see it right
to break our traditional API conventions.  I believe the test should be
fixed.

--------------------------------------------------------------

I am not sure what changed between 3.10 and main that changed/removed
ProcessLookupError as the return for posix.sched_{get|set}affinity
with -1 as the argument, but that appears to be the cause of the current test failure
History
Date User Action Args
2022-04-05 23:05:54koobssetrecipients: + koobs, christian.heimes, miss-islington, kj
2022-04-05 23:05:54koobssetmessageid: <1649199954.76.0.381754704932.issue47205@roundup.psfhosted.org>
2022-04-05 23:05:54koobslinkissue47205 messages
2022-04-05 23:05:54koobscreate