Commit Graph

17 Commits

Author SHA1 Message Date
Padraic Fanning
88e0f13993 Fix unnecessary_lazy_evaluations Clippy warning 2022-02-25 19:33:52 -05:00
snowapril
ab1693e131 Replace new_class to new_exception_type
Replace `new_class` method call for module-level exceptions to newly
added `new_exception_type`

Signed-off-by: snowapril <sinjihng@gmail.com>
2021-11-12 21:40:26 +09:00
snowapril
5e8d3bcacb Remove duplicated static_cell! stmts in each modules
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-11-12 21:40:26 +09:00
David Carlier
d6e89301a5 netbsd/openbsd build fix 2021-11-07 12:48:34 +00:00
Daniel Watkins
9dce9bf0b9 correctly set __module__ and __name__ for builtin exceptions
In CPython's PyErr_NewException[0], the dotted "module.name" passed in is
split on that dot: the content before the dot is set as __module__ in
the created exception class, and the content after it is set as
__name__.

This commit mirrors that behaviour, by introducing a `module` argument
to `PyContext.new_class`: if Some("module_name") is passed, it will be
set as `__module__`.  All exception-creating uses of `new_class` are
updated to pass in their module and class names separately.

[0] https://github.com/python/cpython/blob/main/Python/errors.c#L1082-L1087
2021-11-02 18:28:02 -04:00
David Carlier
f56514d61b netbsd build fix proposal 2021-10-31 08:41:14 +00:00
Noa
09e9ea91e7 TryFrom, TryInto, FromIterator are in prelude now 2021-10-21 17:04:19 -05:00
Jeong YunWon
617e524556 clean up windows socket attrs 2021-10-14 16:36:01 +09:00
Jeong YunWon
141ff2bb2f _socket uses #[pymodule] 2021-10-14 14:11:21 +09:00
varun-krishnan
f5c4c0b4c0 added gethostbyname_ex function 2021-10-13 05:56:54 +09:00
Jeong YunWon
05dca7a7c8 ctx.new_list returns PyLsitRef 2021-10-12 01:22:36 +09:00
Jeong YunWon
a42d547a3f new_{utf8_str, ascii_literal} -> new_str again 2021-10-11 21:28:14 +09:00
Jeong YunWon
379cf2db6f new_bytes return PyRef 2021-10-11 16:10:01 +09:00
Jeong YunWon
616dfc19e2 vm.new_tuple to convert rust tuple to python tuple 2021-10-11 01:06:07 +09:00
Jeong YunWon
741cfea565 vm.ctx.new_int returns PyInt 2021-10-11 01:05:38 +09:00
Jeong YunWon
92de3619fa move IntoPy{Object, Exception, Result} to vm::function
which are used to define function arguments - those functions are mostly placed in the crate
2021-10-06 19:10:16 +09:00
Jeong YunWon
fb25a15f2c split rustpython-stdlib crate 2021-10-01 01:54:04 +09:00