##// END OF EJS Templates
Alternative stricter fix: explicit isoformat(" "),...
Matthias Bussonnier -
Show More
@@ -9,7 +9,6 b' import datetime'
9 9 from pathlib import Path
10 10 import re
11 11 import sqlite3
12 import sys
13 12 import threading
14 13
15 14 from traitlets.config.configurable import LoggingConfigurable
@@ -30,14 +29,6 b' from traitlets import ('
30 29 observe,
31 30 )
32 31
33
34 if sys.version_info >= (3, 12):
35
36 def _adapt_datetime(val):
37 return val.isoformat(" ")
38
39 sqlite3.register_adapter(datetime.datetime, _adapt_datetime)
40
41 32 #-----------------------------------------------------------------------------
42 33 # Classes and functions
43 34 #-----------------------------------------------------------------------------
@@ -583,7 +574,7 b' class HistoryManager(HistoryAccessor):'
583 574 cur = conn.execute(
584 575 """INSERT INTO sessions VALUES (NULL, ?, NULL,
585 576 NULL, '') """,
586 (datetime.datetime.now(),),
577 (datetime.datetime.now().isoformat(" "),),
587 578 )
588 579 self.session_number = cur.lastrowid
589 580
@@ -591,9 +582,15 b' class HistoryManager(HistoryAccessor):'
591 582 """Close the database session, filling in the end time and line count."""
592 583 self.writeout_cache()
593 584 with self.db:
594 self.db.execute("""UPDATE sessions SET end=?, num_cmds=? WHERE
595 session==?""", (datetime.datetime.now(),
596 len(self.input_hist_parsed)-1, self.session_number))
585 self.db.execute(
586 """UPDATE sessions SET end=?, num_cmds=? WHERE
587 session==?""",
588 (
589 datetime.datetime.now().isoformat(" "),
590 len(self.input_hist_parsed) - 1,
591 self.session_number,
592 ),
593 )
597 594 self.session_number = 0
598 595
599 596 def name_session(self, name):
@@ -20,7 +20,6 b' import os'
20 20 import time
21 21
22 22
23
24 23 # prevent jedi/parso's debug messages pipe into interactiveshell
25 24 logging.getLogger("parso").setLevel(logging.WARNING)
26 25
General Comments 0
You need to be logged in to leave comments. Login now