File: moduledef.py

package info (click to toggle)
pypy3 7.3.19%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212,236 kB
  • sloc: python: 2,098,316; ansic: 540,565; sh: 21,462; asm: 14,419; cpp: 4,451; makefile: 4,209; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 12; awk: 4
file content (23 lines) | stat: -rw-r--r-- 910 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from pypy.interpreter.mixedmodule import MixedModule
from pypy.module.errno.interp_errno import name2code

class Module(MixedModule):
    """This module makes available standard errno system symbols.

    The value of each symbol is the corresponding integer value,
    e.g., on most systems, errno.ENOENT equals the integer 2.

    The dictionary errno.errorcode maps numeric codes to symbol names,
    e.g., errno.errorcode[2] could be the string 'ENOENT'.

    Symbols that are not relevant to the underlying system are not defined.

    To map error codes to error messages, use the function os.strerror(),
    e.g. os.strerror(2) could return 'No such file or directory'."""

    appleveldefs = {}
    interpleveldefs = {"errorcode": "interp_errno.get_errorcode(space)"}

for name, code in name2code.iteritems():
    if code is not None:
        Module.interpleveldefs[name] = ("space.newint(%s)" % code)