]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
remove first_init
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 22 Oct 2024 18:03:08 +0000 (14:03 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 22 Oct 2024 18:03:08 +0000 (14:03 -0400)
The ``first_init`` ORM event has been removed.  This event was
non-functional throughout the 1.4 and 2.0 series and could not be invoked
without raising an internal error, so it is not expected that there is any
real-world use of this event hook.

Fixes: #10500
Change-Id: I00b522c9d12e412b3be1fc5c6b96e177e6fca666

doc/build/changelog/unreleased_21/10500.rst [new file with mode: 0644]
lib/sqlalchemy/orm/events.py
lib/sqlalchemy/orm/instrumentation.py

diff --git a/doc/build/changelog/unreleased_21/10500.rst b/doc/build/changelog/unreleased_21/10500.rst
new file mode 100644 (file)
index 0000000..6a8c62c
--- /dev/null
@@ -0,0 +1,8 @@
+.. change::
+    :tags: change, orm
+    :tickets: 10500
+
+    The ``first_init`` ORM event has been removed.  This event was
+    non-functional throughout the 1.4 and 2.0 series and could not be invoked
+    without raising an internal error, so it is not expected that there is any
+    real-world use of this event hook.
index b3f6047d5919bc17ef4911987c2b26e012a03ce3..534637a48c58d00e5a59292bf8d2c1de71c2efda 100644 (file)
@@ -336,16 +336,6 @@ class InstanceEvents(event.Events[ClassManager[Any]]):
         super()._clear()
         _InstanceEventsHold._clear()
 
-    def first_init(self, manager: ClassManager[_O], cls: Type[_O]) -> None:
-        """Called when the first instance of a particular mapping is called.
-
-        This event is called when the ``__init__`` method of a class
-        is called the first time for that particular class.    The event
-        invokes before ``__init__`` actually proceeds as well as before
-        the :meth:`.InstanceEvents.init` event is invoked.
-
-        """
-
     def init(self, target: _O, args: Any, kwargs: Any) -> None:
         """Receive an instance when its constructor is called.
 
index 1452596bebed7de99e94e9d98f4e2e1a7fd8b108..8104e3cabd22b92d9ab01efa44989e1a3d7d988f 100644 (file)
@@ -345,7 +345,6 @@ class ClassManager(
 
     @util.memoized_property
     def _state_constructor(self) -> Type[state.InstanceState[_O]]:
-        self.dispatch.first_init(self, self.class_)
         return state.InstanceState
 
     def manage(self):