From afb5e250a135e97744f12c743520e3cffa6185f5 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Wed, 7 Sep 2022 08:30:40 +1000 Subject: [PATCH] weakref: Add basic stub function to aid in porting. Signed-off-by: Andrew Leech --- python-stdlib/weakref/manifest.py | 3 +++ python-stdlib/weakref/weakref.py | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 python-stdlib/weakref/manifest.py create mode 100644 python-stdlib/weakref/weakref.py diff --git a/python-stdlib/weakref/manifest.py b/python-stdlib/weakref/manifest.py new file mode 100644 index 00000000..dff71931 --- /dev/null +++ b/python-stdlib/weakref/manifest.py @@ -0,0 +1,3 @@ +metadata(version="0.0.1") + +module("weakref.py") diff --git a/python-stdlib/weakref/weakref.py b/python-stdlib/weakref/weakref.py new file mode 100644 index 00000000..a6e15c21 --- /dev/null +++ b/python-stdlib/weakref/weakref.py @@ -0,0 +1,11 @@ +""" +# weakref +https://docs.python.org/3/library/weakref.html + +Micropython does not have support for weakref in the VM, so currently this is a simple stub +module that directly assigns the object reference to simplify porting of other libraries. +""" + + +def ref(obj): + return lambda: obj