Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adodbapi missing files #1445

Merged
merged 70 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
90ffb7a
Fix loader path
xoviat Jan 26, 2018
c7c00ee
add submodules missing from adodbapi module
Mar 12, 2019
9c4c984
upgrate adodbapi to 2.6.1 and supply missing files
Mar 12, 2019
20c578c
drop inadvertantly added files
vernondcole Mar 20, 2019
aec2603
no "s" in adodbapi/test
Apr 10, 2019
4532347
Merge remote-tracking branch 'vc_fork/adodbapi_missing_files' into ad…
Apr 10, 2019
d34cbdc
add submodules missing from adodbapi module
Mar 12, 2019
ad99c93
upgrate adodbapi to 2.6.1 and supply missing files
Mar 12, 2019
59d63ab
no "s" in adodbapi/test
Apr 10, 2019
cf88adb
Merge pull request #1 from mhammond/master
vernondcole Sep 14, 2019
0c355b3
Merge branch 'adodbapi_missing_files' of github.com:vernondcole/pywin…
vernondcole Sep 14, 2019
224d643
provide documentation files and proper test links
vernondcole Sep 15, 2019
acc6289
Mingw compatibility (#1371)
joankaradimov Jul 24, 2019
e91204e
Corrected wMilliseconds truncation in PyTime::getattro(). (#1326)
dbivolaru Jul 24, 2019
84dd552
Add LLK*_LOWER_IL_INJECTED to win32con (#1253)
dsanders11 Jul 24, 2019
f2d7cfc
pywin32.pth: don't blindly append to PATH in case site is repeatedly …
ksmyth Jul 25, 2019
9697a25
Fix gcc/mingw errors for PyWinObject_From(LARGE|ULARGE)_INTEGER (#1377)
joankaradimov Jul 27, 2019
e4ea270
Update some mingw-specific macros (#1379)
joankaradimov Jul 29, 2019
133b839
Fix some MinGW compatibility issues (#1386)
joankaradimov Aug 7, 2019
94330bc
Make some compiler options work with mingw too (#1381)
joankaradimov Aug 7, 2019
3bedc1f
Remove PRIVATE symbols from /EXPORTs (#1394)
stevenwinfield Aug 27, 2019
023ab6e
setup.py: Allow user installations (#1392)
Aug 27, 2019
2ba45ec
Use .def file when linking (#1403)
stevenwinfield Sep 5, 2019
b017c19
postinstall: Adding argument parser and further fixes for user instal…
thopiekar Sep 7, 2019
fdb9c65
tests: Replacing distutils with site (#1393)
thopiekar Sep 7, 2019
799f406
Extract classes for building executables in setup.py (#1389)
joankaradimov Sep 7, 2019
d4b1068
Format c++ sources with clang-format using clang format file aproxima…
konserw Jul 25, 2019
8cf224b
Use subprocess instead of os.spawn to avoid strangeness with quoted args
mhammond Sep 7, 2019
402831f
Fix PyCom_VariantFromPyObject behavior regarding special sequence and…
panikc Aug 9, 2019
729f7f4
Also look for a 32bit windows sdk (#1293)
mhammond Sep 8, 2019
d1ecd8e
Add EdkGuid.h and EdkMdb.h mapi headers (#1404)
nczeczulin Sep 8, 2019
15caa52
minor tweaks to the win32 test runner
mhammond Sep 8, 2019
023a794
SetSecurityDescriptorGroup now accepts None as group value (#1382)
mhammond Sep 9, 2019
7fedaeb
Fix value of ntsecuritycon.FILE_ALL_ACCESS (#1354)
mhammond Sep 9, 2019
b95272e
Ignore the result of win32gui.EnumChildWindows. (#1350)
mhammond Sep 9, 2019
fce4423
Get things working with 3.8 and 3.9
mhammond Sep 9, 2019
502fee0
Use a BytesIO object when loading gencache data from a zip file
mhammond Sep 15, 2019
02d3438
Build 225
mhammond Sep 15, 2019
6c80d3e
Post build 225
mhammond Sep 15, 2019
5dca1f2
Add mapi.OpenStreamOnFileW (#1413)
nczeczulin Sep 25, 2019
a900820
Feature/more mapi guids (#1422)
nczeczulin Oct 1, 2019
755593d
Increase memory allocated for formatting Event Log messages (#1421)
ofek Oct 7, 2019
b156a48
CI: Skip tests with users' action required (#1400)
thopiekar Oct 13, 2019
98aa54f
Fix print statements in post-install script
mhammond Nov 2, 2019
0930551
Fixing #1428: "unicode_internal" workaround (3.8+) (#1429)
t-o-n-y-p Nov 2, 2019
9a60fcb
Add mapi.WrapCompressedRTFStreamEx (#1419)
nczeczulin Nov 2, 2019
66a4753
Use 'utf-16le' instead of 'unicode-internal' in win32gui_struct for 3.8+
mhammond Nov 2, 2019
d19f15c
Allow ints to be used for REQ_QWORD registry values (fixes #1398)
mhammond Nov 3, 2019
672e888
test_win32file now passes time tests on py3 and on py2 with UTCTimes=…
mhammond Nov 3, 2019
109a778
Note in the docs that the UTCTimes param to SetFileTime is ignored on…
mhammond Nov 3, 2019
9c44c50
Conversions to and from COM VT_DATE types should no longer lose milli…
mhammond Nov 5, 2019
bbc09ee
Update to avoid a pending deprecation warning running tests
mhammond Nov 5, 2019
71e71e1
Avoid using rm in build batch file
mhammond Nov 5, 2019
923ea4f
Change how the directory with the pywin32 DLLs is treated at startup.
mhammond Nov 5, 2019
1a4a6fc
Avoid unicode-internal codec in win32verstamp.py for 3.7 too
mhammond Nov 10, 2019
ba162d7
Note a few changes
mhammond Nov 10, 2019
cefe0e3
Fix 64-bit and Unicode issues with win32help. Fixes #1434
mhammond Nov 10, 2019
5aa9444
upgrate adodbapi to 2.6.1 and supply missing files
Mar 12, 2019
3d32b14
add submodules missing from adodbapi module
Mar 12, 2019
13fc996
upgrate adodbapi to 2.6.1 and supply missing files
Mar 12, 2019
2e47ff5
use set literal
vernondcole Nov 16, 2019
bc44b6b
Merge branch 'master' of github.com:mhammond/pywin32
vernondcole Nov 16, 2019
8fddb89
manual merged
vernondcole Nov 16, 2019
f783de6
convert quick_reference to .md, move remote feature to sub-directory
vernondcole Nov 18, 2019
cbe442f
update ado test config to use globally available database servers
vernondcole Nov 22, 2019
bea714c
fix up test runners using globally available DB servers, etc
vernondcole Nov 22, 2019
8379c93
move files to better directories, delete inadvertant, and add a test
vernondcole Nov 23, 2019
c83ce96
revert move of try_connection code, manifest cleanup
vernondcole Nov 23, 2019
76b0998
move remote server into subfolder, fixes for appveyor CI
vernondcole Nov 24, 2019
31ae171
update changes docs
vernondcole Nov 25, 2019
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
Prev Previous commit
Next Next commit
Conversions to and from COM VT_DATE types should no longer lose milli…
…seconds.

Should fix #1385, fix #387
  • Loading branch information
mhammond authored and vernondcole committed Nov 16, 2019
commit 9c44c50475f8856b352adcd601b7df0ef38e5fe1
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ However contributors are encouraged to add their own entries for their work.

Since build 225:
----------------
* Conversions to and from COM VT_DATE types should no longer lose milliseconds.

Since build 224:
----------------
Expand Down
42 changes: 42 additions & 0 deletions com/win32com/test/testDates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from __future__ import print_function

from datetime import datetime
import unittest

import pywintypes
import win32com.client
import win32com.test.util
import win32com.server.util
from win32timezone import TimeZoneInfo

# A COM object so we can pass dates to and from the COM boundary.
class Tester:
_public_methods_ = [ 'TestDate' ]
def TestDate(self, d):
assert isinstance(d, datetime)
return d


def test_ob():
return win32com.client.Dispatch(win32com.server.util.wrap(Tester()))

class TestCase(win32com.test.util.TestCase):
def check(self, d, expected = None):
if not issubclass(pywintypes.TimeType, datetime):
self.skipTest("this is testing pywintypes and datetime")
got = test_ob().TestDate(d)
self.assertEqual(got, expected or d)

def testUTC(self):
self.check(datetime(year=2000, month=12, day=25, microsecond=500000, tzinfo=TimeZoneInfo.utc()))

def testLocal(self):
self.check(datetime(year=2000, month=12, day=25, microsecond=500000, tzinfo=TimeZoneInfo.local()))

def testMSTruncated(self):
# milliseconds are kept but microseconds are lost after rounding.
self.check(datetime(year=2000, month=12, day=25, microsecond=500500, tzinfo=TimeZoneInfo.utc()),
datetime(year=2000, month=12, day=25, microsecond=500000, tzinfo=TimeZoneInfo.utc()))

if __name__=='__main__':
unittest.main()
47 changes: 31 additions & 16 deletions com/win32com/test/testDictionary.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# testDictionary.py
#
import sys
import datetime
import time
import win32com.server.util
import win32com.test.util
import win32com.client
import traceback
import pythoncom
import pywintypes
import winerror
import win32timezone

import unittest

error = "dictionary test error"

def MakeTestDictionary():
return win32com.client.Dispatch("Python.Dictionary")

def TestDictAgainst(dict,check):
for key, value in check.iteritems():
for key, value in check.items():
if dict(key) != value:
raise error("Indexing for '%s' gave the incorrect value - %s/%s" % (repr(key), repr(dict[key]), repr(check[key])))
raise Exception("Indexing for '%s' gave the incorrect value - %s/%s" % (repr(key), repr(dict[key]), repr(check[key])))

# Ensure we have the correct version registered.
def Register(quiet):
Expand All @@ -32,7 +33,7 @@ def TestDict(quiet=None):
quiet = not "-v" in sys.argv
Register(quiet)

if not quiet: print "Simple enum test"
if not quiet: print("Simple enum test")
dict = MakeTestDictionary()
checkDict = {}
TestDictAgainst(dict, checkDict)
Expand All @@ -45,31 +46,45 @@ def TestDict(quiet=None):
del checkDict["NewKey"]
TestDictAgainst(dict, checkDict)

if issubclass(pywintypes.TimeType, datetime.datetime):
now = win32timezone.now()
# We want to keep the milliseconds but discard microseconds as they
# don't survive the conversion.
now = now.replace(microsecond = round(now.microsecond / 1000) * 1000)
else:
now = pythoncom.MakeTime(time.gmtime(time.time()))
dict["Now"] = now
checkDict["Now"] = now
TestDictAgainst(dict, checkDict)

if not quiet:
print "Failure tests"
print("Failure tests")
try:
dict()
raise error("default method with no args worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
raise Exception("default method with no args worked when it shouldnt have!")
except pythoncom.com_error as xxx_todo_changeme:
(hr, desc, exc, argErr) = xxx_todo_changeme.args
if hr != winerror.DISP_E_BADPARAMCOUNT:
raise error("Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc))
raise Exception("Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc))

try:
dict("hi", "there")
raise error("multiple args worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
raise Exception("multiple args worked when it shouldnt have!")
except pythoncom.com_error as xxx_todo_changeme1:
(hr, desc, exc, argErr) = xxx_todo_changeme1.args
if hr != winerror.DISP_E_BADPARAMCOUNT:
raise error("Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc))
raise Exception("Expected DISP_E_BADPARAMCOUNT - got %d (%s)" % (hr, desc))

try:
dict(0)
raise error("int key worked when it shouldnt have!")
except pythoncom.com_error, (hr, desc, exc, argErr):
raise Exception("int key worked when it shouldnt have!")
except pythoncom.com_error as xxx_todo_changeme2:
(hr, desc, exc, argErr) = xxx_todo_changeme2.args
if hr != winerror.DISP_E_TYPEMISMATCH:
raise error("Expected DISP_E_TYPEMISMATCH - got %d (%s)" % (hr, desc))
raise Exception("Expected DISP_E_TYPEMISMATCH - got %d (%s)" % (hr, desc))

if not quiet:
print "Python.Dictionary tests complete."
print("Python.Dictionary tests complete.")

class TestCase(win32com.test.util.TestCase):
def testDict(self):
Expand Down
48 changes: 46 additions & 2 deletions win32/src/PyTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "tchar.h"
#include "math.h"

// Each second as stored in a DATE.
const double ONETHOUSANDMILLISECONDS = 0.00001157407407407407407407407407;

PyObject *PyWin_NewTime(PyObject *timeOb);

BOOL PyWinTime_Check(PyObject *ob)
Expand Down Expand Up @@ -737,10 +740,22 @@ BOOL PyWinObject_AsDATE(PyObject *ob, DATE *pDate)
SYSTEMTIME st;
if (!PyWinObject_AsSYSTEMTIME(ob, &st))
return FALSE;
if (!SystemTimeToVariantTime(&st, pDate)) {
// Extra work to get milliseconds, via
// https://www.codeproject.com/Articles/17576/SystemTime-to-VariantTime-with-Milliseconds
WORD wMilliseconds = st.wMilliseconds;
// not clear why we need to zero this since we always seem to get ms ignored
// but...
st.wMilliseconds = 0;

double dWithoutms;
if (!SystemTimeToVariantTime(&st, &dWithoutms)) {
PyWin_SetAPIError("SystemTimeToVariantTime");
return FALSE;
}
// manually convert the millisecond information into variant
// fraction and add it to system converted value
double OneMilliSecond = ONETHOUSANDMILLISECONDS / 1000;
*pDate = dWithoutms + (OneMilliSecond * wMilliseconds);
return TRUE;
}

Expand Down Expand Up @@ -956,12 +971,41 @@ PyObject *PyWin_NewTime(PyObject *timeOb)
return new PyTime(t);
#endif
}

#ifdef PYWIN_HAVE_DATETIME_CAPI
static double round(double Value, int Digits)
{
assert(Digits >= -4 && Digits <= 4);
int Idx = Digits + 4;
double v[] = {1e-4, 1e-3, 1e-2, 1e-1, 1, 10, 1e2, 1e3, 1e4};
return floor(Value * v[Idx] + 0.5) / (v[Idx]);
}
#endif

PyObject *PyWinObject_FromDATE(DATE t)
{
#ifdef PYWIN_HAVE_DATETIME_CAPI
// via https://www.codeproject.com/Articles/17576/SystemTime-to-VariantTime-with-Milliseconds
// (in particular, see the comments)
double fraction = t - (int)t; // extracts the fraction part
double hours = (fraction - (int)fraction) * 24.0;
double minutes = (hours - (int)hours) * 60.0;
double seconds = round((minutes - (int)minutes) * 60.0, 4);
double milliseconds = round((seconds - (int)seconds) * 1000.0, 0);
// assert(milliseconds>=0.0 && milliseconds<=999.0);

// Strip off the msec part of time
double TimeWithoutMsecs = t - (ONETHOUSANDMILLISECONDS / 1000.0 * milliseconds);

// Let the OS translate the variant date/time
SYSTEMTIME st;
if (!VariantTimeToSystemTime(t, &st))
if (!VariantTimeToSystemTime(TimeWithoutMsecs, &st)) {
return PyWin_SetAPIError("VariantTimeToSystemTime");
}
if (milliseconds > 0.0) {
// add the msec part to the systemtime object
st.wMilliseconds = (WORD)milliseconds;
}
return PyWinObject_FromSYSTEMTIME(st);
#endif // PYWIN_HAVE_DATETIME_CAPI

Expand Down