mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Stop Rust comments on Python items from becoming __doc__ (#8893)
Use `//` instead of `///` on Python-exposed items so their comments are not published as `__doc__`. Assisted-by: Claude:claude-opus-5-5 Assisted-by: Grok:grok-4.7
This commit is contained in:
1 parent
cc8b4d4f7e
commit
4344a34a3c
27 files changed
+95
-96
No files matched your search
@@ -2815,7 +2815,7 @@ pub(crate) mod _asyncio {
|
||||
prev
|
||||
}
|
||||
|
||||
/// Reset task state after fork in child process.
|
||||
// Reset task state after fork in child process.
|
||||
#[pyfunction]
|
||||
#[allow(clippy::unnecessary_wraps)] // keep PyResult for consistency with sibling module functions
|
||||
fn _on_fork(vm: &VirtualMachine) -> PyResult<()> {
|
||||
@@ -2916,7 +2916,7 @@ pub(crate) mod _asyncio {
|
||||
}
|
||||
}
|
||||
|
||||
/// TaskWakeupMethWrapper - wrapper for task wakeup callback with proper repr
|
||||
// TaskWakeupMethWrapper - wrapper for task wakeup callback with proper repr
|
||||
#[pyattr]
|
||||
#[pyclass(name, traverse)]
|
||||
#[derive(Debug, PyPayload)]
|
||||
|
||||
@@ -614,9 +614,9 @@ mod _multibytecodec {
|
||||
Ok(PyRef::new_ref(payload, class, None).into())
|
||||
}
|
||||
|
||||
/// `__create_codec`, which turns the capsule `getcodec` hands it into a
|
||||
/// codec object. Nothing here carries a codec in a capsule, so the argument
|
||||
/// check rejects everything a caller can pass.
|
||||
// `__create_codec`, which turns the capsule `getcodec` hands it into a
|
||||
// codec object. Nothing here carries a codec in a capsule, so the argument
|
||||
// check rejects everything a caller can pass.
|
||||
#[pyfunction(name = "__create_codec")]
|
||||
fn create_codec(_arg: PyObjectRef, vm: &VirtualMachine) -> PyResult {
|
||||
Err(vm.new_value_error("argument type invalid"))
|
||||
|
||||
@@ -37,10 +37,10 @@ pub(crate) mod _elementtree {
|
||||
};
|
||||
use rustpython_common::lock::PyRwLock;
|
||||
|
||||
/// The per-module bookkeeping `_elementtree.c` keeps in its
|
||||
/// `elementtreestate`: the `Comment`/`ProcessingInstruction` factories
|
||||
/// installed by `_set_factories`, and two helpers imported from Python
|
||||
/// the first time they are needed.
|
||||
// The per-module bookkeeping `_elementtree.c` keeps in its
|
||||
// `elementtreestate`: the `Comment`/`ProcessingInstruction` factories
|
||||
// installed by `_set_factories`, and two helpers imported from Python
|
||||
// the first time they are needed.
|
||||
#[pyclass(no_attr, module = "_elementtree", name = "_elementtree_state")]
|
||||
#[derive(Debug, Default, PyPayload)]
|
||||
pub(crate) struct ElementTreeState {
|
||||
@@ -2365,9 +2365,9 @@ pub(crate) mod _elementtree {
|
||||
child_index: usize,
|
||||
}
|
||||
|
||||
/// Pre-order traversal shared by `Element.iter()` and
|
||||
/// `Element.itertext()`, kept as an explicit parent stack so a deep tree
|
||||
/// costs no Rust recursion.
|
||||
// Pre-order traversal shared by `Element.iter()` and
|
||||
// `Element.itertext()`, kept as an explicit parent stack so a deep tree
|
||||
// costs no Rust recursion.
|
||||
#[pyclass(no_attr, module = "_elementtree", name = "_element_iterator")]
|
||||
#[derive(Debug, PyPayload)]
|
||||
pub(crate) struct PyElementIter {
|
||||
|
||||
@@ -754,12 +754,12 @@ mod _json {
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// `_json.make_encoder`, mirroring CPython's `Modules/_json.c` `PyEncoderObject`.
|
||||
///
|
||||
/// Encodes directly into a single growable buffer instead of building a
|
||||
/// generator of chunks, then returns that buffer as a one-element tuple
|
||||
/// (matching what `json/encoder.py`'s `encode()` does with the result:
|
||||
/// `''.join(chunks)`).
|
||||
// `_json.make_encoder` (`PyEncoderObject`).
|
||||
//
|
||||
// Encodes directly into a single growable buffer instead of building a
|
||||
// generator of chunks, then returns that buffer as a one-element tuple
|
||||
// (matching what `json/encoder.py`'s `encode()` does with the result:
|
||||
// `''.join(chunks)`).
|
||||
#[pyattr(name = "make_encoder")]
|
||||
#[pyclass(name = "Encoder", traverse)]
|
||||
#[derive(Debug, PyPayload)]
|
||||
|
||||
@@ -736,7 +736,7 @@ mod _multiprocessing {
|
||||
self.release(vm)
|
||||
}
|
||||
|
||||
/// Rebuild a SemLock from pickled state.
|
||||
// Rebuild a SemLock from pickled state.
|
||||
// _multiprocessing_SemLock__rebuild_impl
|
||||
#[pyclassmethod(name = "_rebuild")]
|
||||
fn rebuild(
|
||||
@@ -895,7 +895,7 @@ mod _multiprocessing {
|
||||
}
|
||||
}
|
||||
|
||||
/// Function to unlink semaphore names.
|
||||
// Function to unlink semaphore names.
|
||||
// _PyMp_sem_unlink.
|
||||
#[pyfunction]
|
||||
fn sem_unlink(name: String, vm: &VirtualMachine) -> PyResult<()> {
|
||||
@@ -908,7 +908,7 @@ mod _multiprocessing {
|
||||
})
|
||||
}
|
||||
|
||||
/// Module-level flags dict.
|
||||
// Module-level flags dict.
|
||||
#[pyattr]
|
||||
fn flags(vm: &VirtualMachine) -> PyRef<PyDict> {
|
||||
let flags = vm.ctx.new_dict();
|
||||
|
||||
@@ -23,10 +23,10 @@ mod _pickle {
|
||||
use num_traits::{ToPrimitive, Zero};
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// The highest protocol number `_pickle` knows how to read.
|
||||
// The highest protocol number `_pickle` knows how to read.
|
||||
#[pyattr]
|
||||
const HIGHEST_PROTOCOL: u8 = 5;
|
||||
/// The protocol `dumps`/`dump` use when no protocol is given.
|
||||
// The protocol `dumps`/`dump` use when no protocol is given.
|
||||
#[pyattr]
|
||||
const DEFAULT_PROTOCOL: u8 = 5;
|
||||
|
||||
@@ -565,7 +565,7 @@ mod _pickle {
|
||||
load_impl(zelf, vm)
|
||||
}
|
||||
|
||||
/// The default hook: no persistent ids are supported.
|
||||
// The default hook: no persistent ids are supported.
|
||||
#[pymethod]
|
||||
fn persistent_load(&self, _pid: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
|
||||
Err(new_unpickling_error(
|
||||
@@ -2049,7 +2049,7 @@ mod _pickle {
|
||||
self.memo.write().clear();
|
||||
}
|
||||
|
||||
/// The default hook: nothing has a persistent id.
|
||||
// The default hook: nothing has a persistent id.
|
||||
#[pymethod]
|
||||
fn persistent_id(&self, _obj: PyObjectRef, vm: &VirtualMachine) -> PyObjectRef {
|
||||
vm.ctx.none()
|
||||
|
||||
@@ -116,8 +116,8 @@ mod resource {
|
||||
}
|
||||
}
|
||||
|
||||
/// The exception the module reports its failures through, which is the one
|
||||
/// every other call raises.
|
||||
// The exception the module reports its failures through, which is the one
|
||||
// every other call raises.
|
||||
#[pyattr(name = "error", once)]
|
||||
fn error(vm: &VirtualMachine) -> PyObjectRef {
|
||||
vm.ctx.exceptions.os_error.to_owned().into()
|
||||
|
||||
@@ -201,17 +201,17 @@ mod _ssl {
|
||||
const VERIFY_CRL_CHECK_LEAF: i32 = rustpython_host_env::ssl::VERIFY_CRL_CHECK_LEAF;
|
||||
#[pyattr]
|
||||
const VERIFY_CRL_CHECK_CHAIN: i32 = rustpython_host_env::ssl::VERIFY_CRL_CHECK_CHAIN;
|
||||
/// VERIFY_X509_STRICT flag for RFC 5280 strict compliance
|
||||
/// When set, performs additional validation including AKI extension checks
|
||||
// VERIFY_X509_STRICT flag for RFC 5280 strict compliance
|
||||
// When set, performs additional validation including AKI extension checks
|
||||
#[pyattr]
|
||||
pub(crate) const VERIFY_X509_STRICT: i32 = rustpython_host_env::ssl::VERIFY_X509_STRICT;
|
||||
#[pyattr]
|
||||
const VERIFY_ALLOW_PROXY_CERTS: i32 = rustpython_host_env::ssl::VERIFY_ALLOW_PROXY_CERTS;
|
||||
#[pyattr]
|
||||
const VERIFY_X509_TRUSTED_FIRST: i32 = rustpython_host_env::ssl::VERIFY_X509_TRUSTED_FIRST;
|
||||
/// VERIFY_X509_PARTIAL_CHAIN flag for partial chain validation
|
||||
/// When set, accept certificates if any certificate in the chain is in the trust store
|
||||
/// (not just root CAs). This matches OpenSSL's X509_V_FLAG_PARTIAL_CHAIN behavior.
|
||||
// VERIFY_X509_PARTIAL_CHAIN flag for partial chain validation
|
||||
// When set, accept certificates if any certificate in the chain is in the trust store
|
||||
// (not just root CAs). This matches OpenSSL's X509_V_FLAG_PARTIAL_CHAIN behavior.
|
||||
#[pyattr]
|
||||
pub(crate) const VERIFY_X509_PARTIAL_CHAIN: i32 =
|
||||
rustpython_host_env::ssl::VERIFY_X509_PARTIAL_CHAIN;
|
||||
@@ -4182,10 +4182,10 @@ mod _ssl {
|
||||
Ok((bytes, true))
|
||||
}
|
||||
|
||||
/// Test helper to decode a certificate from a file path
|
||||
///
|
||||
/// This is a simplified wrapper around cert_der_to_dict_helper that handles
|
||||
/// file reading and PEM/DER auto-detection. Used by test suite.
|
||||
// Test helper to decode a certificate from a file path
|
||||
//
|
||||
// This is a simplified wrapper around cert_der_to_dict_helper that handles
|
||||
// file reading and PEM/DER auto-detection. Used by test suite.
|
||||
#[pyfunction]
|
||||
fn _test_decode_cert(path: PyUtf8StrRef, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
|
||||
// Read certificate file
|
||||
|
||||
@@ -668,8 +668,8 @@ impl Destructor for PyAsyncGenAThrow {
|
||||
}
|
||||
}
|
||||
|
||||
/// Awaitable wrapper for anext() builtin with default value.
|
||||
/// When StopAsyncIteration is raised, it converts it to StopIteration(default).
|
||||
// Awaitable wrapper for anext() builtin with default value.
|
||||
// When StopAsyncIteration is raised, it converts it to StopIteration(default).
|
||||
#[pyclass(module = false, name = "anext_awaitable", traverse = "manual")]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct PyAnextAwaitable {
|
||||
|
||||
@@ -172,7 +172,7 @@ impl Representable for PyMethodDescriptor {
|
||||
}
|
||||
}
|
||||
|
||||
/// METH_CLASS descriptors. Same layout as method_descriptor; a distinct type.
|
||||
// METH_CLASS descriptors. Same layout as method_descriptor; a distinct type.
|
||||
#[pyclass(name = "classmethod_descriptor", module = false)]
|
||||
pub struct PyClassMethodDescriptor {
|
||||
#[pymember(name = "__objclass__", path = "typ")]
|
||||
@@ -1858,7 +1858,7 @@ fn parse_buffer_flags(
|
||||
Ok(crate::protocol::BufferFlags::from_bits_retain(flags as u32))
|
||||
}
|
||||
|
||||
/// wrapper_descriptor: wraps a slot function as a Python method
|
||||
// wrapper_descriptor: wraps a slot function as a Python method
|
||||
// = PyWrapperDescrObject
|
||||
#[pyclass(name = "wrapper_descriptor", module = false)]
|
||||
#[derive(Debug)]
|
||||
@@ -1963,8 +1963,8 @@ impl Representable for PyWrapper {
|
||||
|
||||
// PyMethodWrapper - method-wrapper
|
||||
|
||||
/// method-wrapper: a slot wrapper bound to an instance
|
||||
/// Returned when accessing l.__init__ on an instance
|
||||
// method-wrapper: a slot wrapper bound to an instance
|
||||
// Returned when accessing l.__init__ on an instance
|
||||
#[pyclass(name = "method-wrapper", module = false, traverse)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct PyMethodWrapper {
|
||||
|
||||
@@ -333,7 +333,7 @@ impl PyBaseObject {
|
||||
obj.generic_setattr(attr_name, value, vm)
|
||||
}
|
||||
|
||||
/// Return str(self).
|
||||
// Return str(self).
|
||||
#[pyslot]
|
||||
fn slot_str(zelf: &PyObject, vm: &VirtualMachine) -> PyResult<PyStrRef> {
|
||||
// FIXME: try tp_repr first and fallback to object.__repr__
|
||||
@@ -472,9 +472,9 @@ impl PyBaseObject {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return getattr(self, name).
|
||||
///
|
||||
/// __getattribute__ is added as a slot wrapper by add_operators.
|
||||
// Return getattr(self, name).
|
||||
//
|
||||
// __getattribute__ is added as a slot wrapper by add_operators.
|
||||
#[pyslot]
|
||||
pub(crate) fn getattro(obj: &PyObject, name: &Py<PyStr>, vm: &VirtualMachine) -> PyResult {
|
||||
vm_trace!("object.__getattribute__({:?}, {:?})", obj, name);
|
||||
|
||||
@@ -3495,7 +3495,7 @@ pub(super) mod types {
|
||||
}
|
||||
}
|
||||
|
||||
/// JIT error.
|
||||
// JIT error.
|
||||
#[cfg(feature = "jit")]
|
||||
#[pyexception(name, base = PyException, ctx = "jit_error", impl)]
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -1523,8 +1523,7 @@ impl InterpreterFrame {
|
||||
}
|
||||
}
|
||||
|
||||
/// Python-visible frame object. Currently always wraps an `InterpreterFrame`.
|
||||
/// Analogous to CPython's `PyFrameObject`.
|
||||
// Python-visible frame object (`PyFrameObject`). Currently always wraps an `InterpreterFrame`.
|
||||
#[pyclass(module = false, name = "frame", traverse = "manual")]
|
||||
pub struct FrameObject {
|
||||
// The executing iframe reads this when it points at the frame object.
|
||||
|
||||
@@ -1012,8 +1012,8 @@ unsafe impl Link for WeakLink {
|
||||
}
|
||||
}
|
||||
|
||||
/// PyWeakReference: each weakref holds a direct pointer to its referent.
|
||||
#[pyclass(name = "weakref", module = false)]
|
||||
// PyWeakReference: each weakref holds a direct pointer to its referent.
|
||||
#[pyclass(name = "ReferenceType", module = "weakref")]
|
||||
#[derive(Debug)]
|
||||
pub struct PyWeak {
|
||||
pointers: Pointers<Py<Self>>,
|
||||
|
||||
@@ -28,7 +28,7 @@ mod _abc {
|
||||
ABC_INVALIDATION_COUNTER.fetch_add(1, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// Internal state held by ABC machinery.
|
||||
// Internal state held by ABC machinery.
|
||||
#[pyattr]
|
||||
#[pyclass(name = "_abc_data", module = "_abc")]
|
||||
#[derive(Debug, PyPayload)]
|
||||
|
||||
@@ -102,8 +102,8 @@ pub(crate) mod _ctypes {
|
||||
use crate::{AsObject, Py, PyObjectRef, PyPayload, PyResult, VirtualMachine};
|
||||
use num_traits::ToPrimitive;
|
||||
|
||||
/// CArgObject - returned by byref() and paramfunc
|
||||
/// tagPyCArgObject
|
||||
// CArgObject - returned by byref() and paramfunc
|
||||
// tagPyCArgObject
|
||||
#[pyclass(name = "CArgObject", module = "_ctypes", no_attr)]
|
||||
#[derive(Debug, PyPayload)]
|
||||
pub(crate) struct CArgObject {
|
||||
@@ -840,7 +840,7 @@ pub(crate) mod _ctypes {
|
||||
super::function::cast_impl(&obj, src, &ctype, vm)
|
||||
}
|
||||
|
||||
/// Python-level cast function (PYFUNCTYPE wrapper)
|
||||
// Python-level cast function (PYFUNCTYPE wrapper)
|
||||
#[pyfunction]
|
||||
fn cast(obj: PyObjectRef, typ: PyObjectRef, vm: &VirtualMachine) -> PyResult {
|
||||
super::function::cast_impl(&obj, obj.clone(), &typ, vm)
|
||||
@@ -883,7 +883,7 @@ pub(crate) mod _ctypes {
|
||||
.into())
|
||||
}
|
||||
|
||||
/// Unpickle a ctypes object.
|
||||
// Unpickle a ctypes object.
|
||||
#[pyfunction]
|
||||
fn _unpickle(typ: PyObjectRef, state: PyObjectRef, vm: &VirtualMachine) -> PyResult {
|
||||
if !state.class().is(vm.ctx.types.tuple_type.as_ref()) {
|
||||
@@ -894,7 +894,7 @@ pub(crate) mod _ctypes {
|
||||
Ok(obj)
|
||||
}
|
||||
|
||||
/// Call a function at the given address with the given arguments.
|
||||
// Call a function at the given address with the given arguments.
|
||||
#[pyfunction]
|
||||
fn call_function(
|
||||
func_addr: ArgStrictInt<usize>,
|
||||
@@ -905,7 +905,7 @@ pub(crate) mod _ctypes {
|
||||
call_function_internal(func_addr, args, 0, vm)
|
||||
}
|
||||
|
||||
/// Call a cdecl function at the given address with the given arguments.
|
||||
// Call a cdecl function at the given address with the given arguments.
|
||||
#[pyfunction]
|
||||
fn call_cdeclfunction(
|
||||
func_addr: ArgStrictInt<usize>,
|
||||
@@ -952,7 +952,7 @@ pub(crate) mod _ctypes {
|
||||
Ok(vm.ctx.new_int(result).into())
|
||||
}
|
||||
|
||||
/// Convert a pointer (as integer) to a Python object.
|
||||
// Convert a pointer (as integer) to a Python object.
|
||||
#[pyfunction(name = "PyObj_FromPtr")]
|
||||
fn py_obj_from_ptr(ptr: ArgStrictInt<usize>, vm: &VirtualMachine) -> PyResult {
|
||||
let ptr = ptr.value;
|
||||
|
||||
@@ -165,7 +165,7 @@ fn create_array_type_with_name(
|
||||
Ok(new_type)
|
||||
}
|
||||
|
||||
/// PyCArrayType - metatype for Array types
|
||||
// PyCArrayType - metatype for Array types
|
||||
#[pyclass(name = "PyCArrayType", base = PyType, module = "_ctypes")]
|
||||
#[derive(Debug)]
|
||||
#[repr(transparent)]
|
||||
|
||||
@@ -452,7 +452,7 @@ fn wstring_at_impl(ptr: usize, size: isize, vm: &VirtualMachine) -> PyResult {
|
||||
}
|
||||
}
|
||||
|
||||
/// A buffer wrapping raw memory at a given pointer, for zero-copy memoryview.
|
||||
// A buffer wrapping raw memory at a given pointer, for zero-copy memoryview.
|
||||
#[pyclass(name = "_RawMemoryBuffer", module = "_ctypes")]
|
||||
#[derive(Debug, PyPayload)]
|
||||
pub(super) struct RawMemoryBuffer {
|
||||
@@ -1921,7 +1921,7 @@ unsafe extern "C" fn thunk_callback(
|
||||
});
|
||||
}
|
||||
|
||||
/// CThunkObject wraps a Python callable to make it callable from C code.
|
||||
// CThunkObject wraps a Python callable to make it callable from C code.
|
||||
#[pyclass(name = "CThunkObject", module = "_ctypes")]
|
||||
#[derive(PyPayload)]
|
||||
pub(super) struct PyCThunk {
|
||||
|
||||
@@ -319,7 +319,7 @@ impl PyCPointer {
|
||||
);
|
||||
}
|
||||
|
||||
/// contents getter - reads address from b_ptr and creates an instance of the pointed-to type
|
||||
// contents getter - reads address from b_ptr and creates an instance of the pointed-to type
|
||||
#[pygetset]
|
||||
fn contents(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
|
||||
// Pointer_get_contents
|
||||
@@ -343,8 +343,8 @@ impl PyCPointer {
|
||||
.map(Into::into)
|
||||
}
|
||||
|
||||
/// contents setter - stores address in b_ptr and keeps reference
|
||||
/// Pointer_set_contents
|
||||
// contents setter - stores address in b_ptr and keeps reference
|
||||
// Pointer_set_contents
|
||||
#[pygetset(setter)]
|
||||
fn set_contents(zelf: &Py<Self>, value: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
|
||||
// Get stginfo and proto for type validation
|
||||
|
||||
@@ -1238,9 +1238,9 @@ impl PyCSimple {
|
||||
array_type_from_ctype(cls.into(), n as usize, vm)
|
||||
}
|
||||
|
||||
/// Simple_from_outparm - convert output parameter back to Python value
|
||||
/// For direct subclasses of _SimpleCData (e.g., c_int), returns the value.
|
||||
/// For subclasses of those (e.g., class MyInt(c_int)), returns self.
|
||||
// Simple_from_outparm - convert output parameter back to Python value
|
||||
// For direct subclasses of _SimpleCData (e.g., c_int), returns the value.
|
||||
// For subclasses of those (e.g., class MyInt(c_int)), returns self.
|
||||
#[pymethod]
|
||||
fn __ctypes_from_outparam__(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
|
||||
// _ctypes_simple_instance: returns true if NOT a direct subclass of Simple_Type
|
||||
|
||||
@@ -28,7 +28,7 @@ pub(super) fn calculate_struct_size(cls: &Py<PyType>, vm: &VirtualMachine) -> Py
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
/// PyCStructType - metaclass for Structure
|
||||
// PyCStructType - metaclass for Structure
|
||||
#[pyclass(name = "PyCStructType", base = PyType, module = "_ctypes")]
|
||||
#[derive(Debug)]
|
||||
#[repr(transparent)]
|
||||
@@ -218,7 +218,7 @@ impl PyCStructType {
|
||||
PyCData::in_dll(cls, dll, name, vm)
|
||||
}
|
||||
|
||||
/// Called when a new Structure subclass is created
|
||||
// Called when a new Structure subclass is created
|
||||
#[pyclassmethod]
|
||||
fn __init_subclass__(cls: PyTypeRef, vm: &VirtualMachine) -> PyResult<()> {
|
||||
cls.mark_bases_final();
|
||||
|
||||
@@ -29,7 +29,7 @@ pub(super) fn calculate_union_size(cls: &Py<PyType>, vm: &VirtualMachine) -> PyR
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
/// PyCUnionType - metaclass for Union
|
||||
// PyCUnionType - metaclass for Union
|
||||
#[pyclass(name = "UnionType", base = PyType, module = "_ctypes")]
|
||||
#[derive(Debug)]
|
||||
#[repr(transparent)]
|
||||
@@ -466,7 +466,7 @@ impl PyCUnionType {
|
||||
PyCData::in_dll(cls, dll, name, vm)
|
||||
}
|
||||
|
||||
/// Called when a new Union subclass is created
|
||||
// Called when a new Union subclass is created
|
||||
#[pyclassmethod]
|
||||
fn __init_subclass__(cls: PyTypeRef, vm: &VirtualMachine) -> PyResult<()> {
|
||||
cls.mark_bases_final();
|
||||
|
||||
@@ -671,7 +671,7 @@ pub(crate) mod _interpchannels {
|
||||
flags(BASETYPE, IMMUTABLETYPE, DISALLOW_INSTANTIATION)
|
||||
)]
|
||||
impl ChannelID {
|
||||
/// `channelid_richcompare`.
|
||||
// `channelid_richcompare`.
|
||||
#[pyslot]
|
||||
fn slot_richcompare(
|
||||
zelf: &PyObject,
|
||||
|
||||
@@ -6376,7 +6376,7 @@ mod fileio {
|
||||
Err(vm.new_type_error(format!("cannot pickle '{}' instances", zelf.class().name())))
|
||||
}
|
||||
|
||||
/// fileio_dealloc_warn in Modules/_io/fileio.c
|
||||
// fileio_dealloc_warn in Modules/_io/fileio.c
|
||||
#[pymethod(name = "_dealloc_warn")]
|
||||
fn _dealloc_warn_method(zelf: &Py<Self>, object: PyObjectRef, vm: &VirtualMachine) {
|
||||
Self::dealloc_warn(zelf, &object, vm);
|
||||
|
||||
@@ -480,8 +480,8 @@ mod _winapi {
|
||||
vm.ctx.none()
|
||||
}
|
||||
|
||||
/// LCMapStringEx - Map a string to another string using locale-specific rules
|
||||
/// This is used by ntpath.normcase() for proper Windows case conversion
|
||||
// LCMapStringEx - Map a string to another string using locale-specific rules
|
||||
// This is used by ntpath.normcase() for proper Windows case conversion
|
||||
#[pyfunction]
|
||||
fn LCMapStringEx(
|
||||
locale: PyStrRef,
|
||||
@@ -541,7 +541,7 @@ mod _winapi {
|
||||
_security_attributes: PyObjectRef, // Ignored, can be None
|
||||
}
|
||||
|
||||
/// CreateNamedPipe - Create a named pipe
|
||||
// CreateNamedPipe - Create a named pipe
|
||||
#[pyfunction]
|
||||
fn CreateNamedPipe(args: CreateNamedPipeArgs, vm: &VirtualMachine) -> PyResult<WinHandle> {
|
||||
let name = args
|
||||
@@ -694,7 +694,7 @@ mod _winapi {
|
||||
Ok(path_name_result_to_pystr(wide, vm))
|
||||
}
|
||||
|
||||
/// WaitNamedPipe - Wait for an instance of a named pipe to become available.
|
||||
// WaitNamedPipe - Wait for an instance of a named pipe to become available.
|
||||
#[pyfunction]
|
||||
fn WaitNamedPipe(name: PyStrRef, timeout: u32, vm: &VirtualMachine) -> PyResult<()> {
|
||||
let name = name
|
||||
@@ -704,7 +704,7 @@ mod _winapi {
|
||||
host_winapi::wait_named_pipe_w(&name, timeout).map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// PeekNamedPipe - Peek at data in a named pipe without removing it.
|
||||
// PeekNamedPipe - Peek at data in a named pipe without removing it.
|
||||
#[pyfunction]
|
||||
fn PeekNamedPipe(
|
||||
handle: WinHandle,
|
||||
@@ -743,7 +743,7 @@ mod _winapi {
|
||||
}
|
||||
}
|
||||
|
||||
/// CreateEventW - Create or open a named or unnamed event object.
|
||||
// CreateEventW - Create or open a named or unnamed event object.
|
||||
#[pyfunction]
|
||||
fn CreateEventW(
|
||||
security_attributes: isize, // Always NULL (0)
|
||||
@@ -763,7 +763,7 @@ mod _winapi {
|
||||
.map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// SetEvent - Set the specified event object to the signaled state.
|
||||
// SetEvent - Set the specified event object to the signaled state.
|
||||
#[pyfunction]
|
||||
fn SetEvent(event: WinHandle, vm: &VirtualMachine) -> PyResult<()> {
|
||||
host_winapi::set_event(event.0).map_err(|e| e.to_pyexception(vm))
|
||||
@@ -779,7 +779,7 @@ mod _winapi {
|
||||
overlapped: bool,
|
||||
}
|
||||
|
||||
/// WriteFile - Write data to a file or I/O device.
|
||||
// WriteFile - Write data to a file or I/O device.
|
||||
#[pyfunction]
|
||||
fn WriteFile(args: WriteFileArgs, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
|
||||
let handle = args.handle;
|
||||
@@ -819,7 +819,7 @@ mod _winapi {
|
||||
overlapped: bool,
|
||||
}
|
||||
|
||||
/// ReadFile - Read data from a file or I/O device.
|
||||
// ReadFile - Read data from a file or I/O device.
|
||||
#[pyfunction]
|
||||
fn ReadFile(args: ReadFileArgs, vm: &VirtualMachine) -> PyResult<PyObjectRef> {
|
||||
let handle = args.handle;
|
||||
@@ -850,7 +850,7 @@ mod _winapi {
|
||||
.into())
|
||||
}
|
||||
|
||||
/// SetNamedPipeHandleState - Set the read mode and other options of a named pipe.
|
||||
// SetNamedPipeHandleState - Set the read mode and other options of a named pipe.
|
||||
#[pyfunction]
|
||||
fn SetNamedPipeHandleState(
|
||||
named_pipe: WinHandle,
|
||||
@@ -870,13 +870,13 @@ mod _winapi {
|
||||
.map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// ResetEvent - Reset the specified event object to the nonsignaled state.
|
||||
// ResetEvent - Reset the specified event object to the nonsignaled state.
|
||||
#[pyfunction]
|
||||
fn ResetEvent(event: WinHandle, vm: &VirtualMachine) -> PyResult<()> {
|
||||
host_winapi::reset_event(event.0).map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// CreateMutexW - Create or open a named or unnamed mutex object.
|
||||
// CreateMutexW - Create or open a named or unnamed mutex object.
|
||||
#[pyfunction]
|
||||
fn CreateMutexW(
|
||||
security_attributes: isize,
|
||||
@@ -894,7 +894,7 @@ mod _winapi {
|
||||
.map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// OpenEventW - Open an existing named event object.
|
||||
// OpenEventW - Open an existing named event object.
|
||||
#[pyfunction]
|
||||
fn OpenEventW(
|
||||
desired_access: u32,
|
||||
@@ -992,7 +992,7 @@ mod _winapi {
|
||||
}
|
||||
}
|
||||
|
||||
/// CreateFileMapping - Create or open a named or unnamed file mapping object.
|
||||
// CreateFileMapping - Create or open a named or unnamed file mapping object.
|
||||
#[pyfunction]
|
||||
fn CreateFileMapping(
|
||||
file_handle: WinHandle,
|
||||
@@ -1018,7 +1018,7 @@ mod _winapi {
|
||||
.map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// OpenFileMapping - Open a named file mapping object.
|
||||
// OpenFileMapping - Open a named file mapping object.
|
||||
#[pyfunction]
|
||||
fn OpenFileMapping(
|
||||
desired_access: u32,
|
||||
@@ -1035,7 +1035,7 @@ mod _winapi {
|
||||
.map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// MapViewOfFile - Map a view of a file mapping into the address space.
|
||||
// MapViewOfFile - Map a view of a file mapping into the address space.
|
||||
#[pyfunction]
|
||||
fn MapViewOfFile(
|
||||
file_map: WinHandle,
|
||||
@@ -1055,13 +1055,13 @@ mod _winapi {
|
||||
.map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// UnmapViewOfFile - Unmap a mapped view of a file.
|
||||
// UnmapViewOfFile - Unmap a mapped view of a file.
|
||||
#[pyfunction]
|
||||
fn UnmapViewOfFile(address: isize, vm: &VirtualMachine) -> PyResult<()> {
|
||||
host_winapi::unmap_view_of_file(address).map_err(|e| e.to_pyexception(vm))
|
||||
}
|
||||
|
||||
/// VirtualQuerySize - Return the size of a memory region.
|
||||
// VirtualQuerySize - Return the size of a memory region.
|
||||
#[pyfunction]
|
||||
fn VirtualQuerySize(address: isize, vm: &VirtualMachine) -> PyResult<usize> {
|
||||
host_winapi::virtual_query_size(address).map_err(|e| e.to_pyexception(vm))
|
||||
|
||||
@@ -258,13 +258,13 @@ mod gc {
|
||||
gc_state::gc_state().get_freeze_count()
|
||||
}
|
||||
|
||||
/// gc.garbage - list of uncollectable objects
|
||||
// gc.garbage - list of uncollectable objects
|
||||
#[pyattr]
|
||||
fn garbage(vm: &VirtualMachine) -> PyListRef {
|
||||
vm.state.gc.py_garbage.clone()
|
||||
}
|
||||
|
||||
/// gc.callbacks - list of callbacks to be invoked
|
||||
// gc.callbacks - list of callbacks to be invoked
|
||||
#[pyattr]
|
||||
fn callbacks(vm: &VirtualMachine) -> PyListRef {
|
||||
vm.state.gc.py_callbacks.clone()
|
||||
|
||||
@@ -259,8 +259,8 @@ mod _js {
|
||||
type_of(&self.value)
|
||||
}
|
||||
|
||||
/// Checks that `typeof self == "object" && self !== null`. Use instead
|
||||
/// of `value.typeof() == "object"`
|
||||
// Checks that `typeof self == "object" && self !== null`. Use instead
|
||||
// of `value.typeof() == "object"`
|
||||
#[pymethod]
|
||||
fn is_object(&self) -> bool {
|
||||
self.value.is_object()
|
||||
|
||||
Reference in new issue
Block a user