Skip to content

Commit

Permalink
Fix DeprecationWarning on 3.12 with a datetime adapter for sqlite3 (i…
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau authored Aug 28, 2023
2 parents 175d52c + e1a3ce3 commit 46c7ccf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 10 additions & 4 deletions IPython/core/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,17 +574,23 @@ def new_session(self, conn=None):
cur = conn.execute(
"""INSERT INTO sessions VALUES (NULL, ?, NULL,
NULL, '') """,
(datetime.datetime.now(),),
(datetime.datetime.now().isoformat(" "),),
)
self.session_number = cur.lastrowid

def end_session(self):
"""Close the database session, filling in the end time and line count."""
self.writeout_cache()
with self.db:
self.db.execute("""UPDATE sessions SET end=?, num_cmds=? WHERE
session==?""", (datetime.datetime.now(),
len(self.input_hist_parsed)-1, self.session_number))
self.db.execute(
"""UPDATE sessions SET end=?, num_cmds=? WHERE
session==?""",
(
datetime.datetime.now().isoformat(" "),
len(self.input_hist_parsed) - 1,
self.session_number,
),
)
self.session_number = 0

def name_session(self, name):
Expand Down
1 change: 0 additions & 1 deletion IPython/core/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import time



# prevent jedi/parso's debug messages pipe into interactiveshell
logging.getLogger("parso").setLevel(logging.WARNING)

Expand Down

0 comments on commit 46c7ccf

Please sign in to comment.