Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/stdlib/src/_asyncio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down Expand Up @@ -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)]
Expand Down
6 changes: 3 additions & 3 deletions crates/stdlib/src/cjkcodecs/multibytecodec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
14 changes: 7 additions & 7 deletions crates/stdlib/src/elementtree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions crates/stdlib/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 3 additions & 3 deletions crates/stdlib/src/multiprocessing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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<()> {
Expand All @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions crates/stdlib/src/pickle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions crates/stdlib/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 9 additions & 9 deletions crates/stdlib/src/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/builtins/asyncgenerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions crates/vm/src/builtins/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions crates/vm/src/builtins/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 1 addition & 2 deletions crates/vm/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/object/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/_abc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
14 changes: 7 additions & 7 deletions crates/vm/src/stdlib/_ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()) {
Expand All @@ -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>,
Expand All @@ -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>,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/_ctypes/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/stdlib/_ctypes/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions crates/vm/src/stdlib/_ctypes/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading
Loading